Exemple #1
0
        public void GcdEuclidianWithThreeNumbersTest()
        {
            //Arrange
            int a = 504, b = 313, c = 732;
            //Act
            int result = FindGcd.Gcd(a, b, c, FindGcd.GcdEuclidian);

            //Assert
            Assert.AreEqual(1, result);
        }
Exemple #2
0
        public void GcdEuclidianWithParamsNumbersTest()
        {
            //Arrange
            int[] param = { 212, 68, 44, 200 };
            //Act
            int result = FindGcd.Gcd(FindGcd.GcdEuclidian, param);

            //Assert
            Assert.AreEqual(4, result);
        }
Exemple #3
0
        public void GcdEuclidianWithTwoNumbersZeroSecondTest()
        {
            //Arrange
            int a = 122, b = 0;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian);

            //Assert
            Assert.AreEqual(122, result);
        }
Exemple #4
0
        public void GcdEuclidianWithTwoNumbersOneTest()
        {
            //Arrange
            int a = 1, b = 256;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian);

            //Assert
            Assert.AreEqual(1, result);
        }
Exemple #5
0
        public void GcdEuclidianWithTwoNumbersZeroFirstTest()
        {
            //Arrange
            int a = 0, b = 256;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian);

            //Assert
            Assert.AreEqual(256, result);
        }
Exemple #6
0
        public void GcdSteinsWithTwoNumbersOneTest()
        {
            //Arrange
            int a = 134, b = 1;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins);

            //Assert
            Assert.AreEqual(1, result);
        }
Exemple #7
0
        public void GcdSteinsWithTwoNumbersSecondZeroTest()
        {
            //Arrange
            int a = 134, b = 0;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins);

            //Assert
            Assert.AreEqual(134, result);
        }
Exemple #8
0
        public void GcdSteinsWithTwoNumbersFirsZeroTest()
        {
            //Arrange
            int a = 0, b = 256;
            //Act
            int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins);

            //Assert
            Assert.AreEqual(256, result);
        }
Exemple #9
0
        public void GcdEuclidianWithParamsNumbersWithTimeTest()
        {
            //Arrange
            int[] param = { 212, 68, 44, 200 };
            long  time;
            //Act
            int result = FindGcd.Gcd(out time, FindGcd.GcdEuclidian, param);

            //Assert
            Assert.AreEqual(4, result);
            Assert.IsNotNull(time);
        }
Exemple #10
0
        static void Main(string[] args)
        {
            int a = 32, b = 64, c = 126;

            int[] list = { 27, 84, 36, 98, 21 };
            long  time;

            Console.WriteLine("Euclidian algorithm for {0} and {1} without lead time :\n" + "Gcd :" + FindGcd.Gcd(a, b, FindGcd.GcdEuclidian), a, b);
            Console.WriteLine("Euclidian algorithm for {0} and {1} without lead time :\n" + "Gcd :" + FindGcd.Gcd(0, 0, FindGcd.GcdEuclidian), 0, 0);
            Console.WriteLine("Euclidian algorithm for {0},{1} and {2} with lead time :\n" + "Gcd :" + FindGcd.Gcd(a, b, c, out time, FindGcd.GcdEuclidian) + " time :" + time, a, b, c);
            Console.WriteLine("Euclidian algorithm for list {27, 84, 36, 98, 21} with lead time :\n" + "Gcd :" + FindGcd.Gcd(out time, FindGcd.GcdEuclidian, list) + " time :" + time);

            Console.WriteLine("----------------------------------------------");
            Console.WriteLine("Stein's algorithm for {0} and {1} without lead time :\n" + "Gcd :" + FindGcd.Gcd(a, b, FindGcd.GcdSteins), a, b);
            Console.WriteLine("Euclidian algorithm for {0} and {1} without lead time :\n" + "Gcd :" + FindGcd.Gcd(0, 0, FindGcd.GcdSteins), 0, 0);
            Console.WriteLine("Stein's algorithm for {0},{1} and {2} with lead time :\n" + "Gcd :" + FindGcd.Gcd(a, b, c, out time, FindGcd.GcdSteins) + " time :" + time, a, b, c);
            Console.WriteLine("Stein's algorithm for list {27, 84, 36, 98, 21} with lead time :\n" + "Gcd :" + FindGcd.Gcd(out time, FindGcd.GcdSteins, list) + " time :" + time);

            Console.ReadKey();
        }
Exemple #11
0
 public int FindGcdSteinAlg(int a, int b)
 {
     return(FindGcd.Gcd(a, b, FindGcd.GcdSteins));;
 }
Exemple #12
0
 public int FindGcdEuclAlg(int a, int b)
 {
     return(FindGcd.Gcd(a, b, FindGcd.GcdEuclidian));;
 }