Exemple #1
0
        public void Euclidean_LeadTime_Less1s(int number1, int number2, params int[] numbers)
        {
            TimeSpan time   = new TimeSpan();
            int      result = GCD.Euclidean(out time, number1, number2, numbers);

            Assert.IsTrue(time.Seconds <= 1, $"Lead time is {time.ToString()}");
        }
Exemple #2
0
        public long Euclidean_Params_Test(params long[] array)
        {
            long ticks;

            long result = GCD.Euclidean(out ticks, array);

            Debug.WriteLine($"Total ellapsed time: {ticks}");
            return(result);
        }
Exemple #3
0
        public long Euclidean_TwoParameters_Test(long a, long b)
        {
            long ticks;

            long result = GCD.Euclidean(a, b, out ticks);

            Debug.WriteLine($"Total ellapsed time: {ticks}");
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// Метод Евклида для вычисления НОД двух целых чисел
        /// </summary>
        public void Euclidean_1071And462_Returned_21()
        {
            //arrange
            long     a        = 1071;
            long     b        = 462;
            long     expected = 21;
            TimeSpan time;

            //assert
            Assert.AreEqual(expected, GCD.Euclidean(out time, a, b));
        }
Exemple #5
0
        /// <summary>
        /// Метод Евклида для вычисления НОД трех целых чисел
        /// </summary>
        public void Euclidean_1071_462_And7_Returned_7()
        {
            //arrange
            long     a        = 1071;
            long     b        = 462;
            long     c        = 7;
            long     expected = 7;
            TimeSpan time;

            //assert
            Assert.AreEqual(expected, GCD.Euclidean(out time, a, b, c));
        }
Exemple #6
0
        /// <summary>
        /// Метод Евклида для вычисления НОД четырех целых чисел
        /// </summary>
        public void Euclidean_15_55_5_25_Returned_5()
        {
            //arrange
            long     a        = 15;
            long     b        = 55;
            long     c        = 5;
            long     d        = 25;
            long     expected = 5;
            TimeSpan time;

            //assert
            Assert.AreEqual(expected, GCD.Euclidean(out time, a, b, c, d));
        }
Exemple #7
0
        /// <summary>
        /// Метод Евклида для вычисления НОД пяти целых чисел
        /// </summary>
        public void Euclidean_26_2_224_12_7_Returned_1()
        {
            //arrange
            long     a        = 26;
            long     b        = 2;
            long     c        = 224;
            long     d        = 12;
            long     e        = 7;
            long     expected = 1;
            TimeSpan time;

            //assert
            Assert.AreEqual(expected, GCD.Euclidean(out time, a, b, c, d, e));
        }
        public void BinaryMethod_Array_ReturnGCD(int[] array, int expected)
        {
            int actual = GCD.Euclidean(array);

            Assert.AreEqual(expected, actual);
        }
 public void EucledianMethod_Array_ReturnAgrumentException(int[] array)
 {
     Assert.Throws <ArgumentException>(() => GCD.Euclidean(array));
 }
Exemple #10
0
 public void Euclidean_NullArgument_ArgumentsNullException()
 {
     Assert.Throws <ArgumentNullException>(() => GCD.Euclidean(4, 16, null));
 }
Exemple #11
0
 public int Euclidean_CorrectArguments(int number1, int number2, params int[] numbers)
 {
     return(GCD.Euclidean(number1, number2, numbers));
 }