public void Test2_EuclideanGCD()
        {
            // arrange
            int expected = 17;

            // act
            int a      = 527;
            int b      = 748;
            int answer = GCD.EuclideanGCD(a, b);

            // assert
            Assert.AreEqual(expected, answer);
        }
        public void Test1_EuclideanGCD()
        {
            // arrange
            int expected = 21;

            // act
            int a      = 1071;
            int b      = 462;
            int answer = GCD.EuclideanGCD(a, b);

            // assert
            Assert.AreEqual(expected, answer);
        }
        public void Test4_EuclideanGCD()
        {
            // arrange
            int expected = 6;

            // act
            int a      = 78;
            int b      = 294;
            int c      = 570;
            int answer = GCD.EuclideanGCD(a, b, c);

            // assert
            Assert.AreEqual(expected, answer);
        }
        public void Test3_EuclideanGCD()
        {
            // arrange
            int expected = 44;

            // act
            int  a = 44;
            int  b = 44;
            long time;
            int  answer = GCD.EuclideanGCD(a, b, out time);

            // assert
            Assert.AreEqual(expected, answer);
        }
        public void Test6_EuclideanGCD()
        {
            // arrange
            int expected = 23;

            // act
            int a      = 161;
            int b      = 253;
            int c      = 230;
            int d      = 529;
            int e      = 437;
            int answer = GCD.EuclideanGCD(a, b, c, d, e);

            // assert
            Assert.AreEqual(expected, answer);
        }
Beispiel #6
0
        public int GCDEuclideanCount(params int[] nums)
        {
            double execTime = 0;

            return(GCD.EuclideanGCD(out execTime, nums));
        }
Beispiel #7
0
 public void EuclideanGCD_NumOfParamsLessThan2_ArgumentException()
 {
     Assert.Throws <ArgumentException>(() => GCD.EuclideanGCD(1));
 }
Beispiel #8
0
 public int EuclideanGCD_MoreThanTwoArguments_EqualToResult(params int[] numbers)
 {
     return(GCD.EuclideanGCD(numbers));
 }
Beispiel #9
0
 public void EuclideanGCD_TwoZerosInParams_ArgumentException()
 {
     Assert.Throws <ArgumentException>(() => GCD.EuclideanGCD(0, 0));
 }
Beispiel #10
0
 public void EuclideanGCD_Params_EqualToExpectedResult(int a, int b, int r)
 {
     Assert.AreEqual(r, GCD.EuclideanGCD(a, b));
 }