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); }
public void GcdEuclidianWithParamsNumbersTest() { //Arrange int[] param = { 212, 68, 44, 200 }; //Act int result = FindGcd.Gcd(FindGcd.GcdEuclidian, param); //Assert Assert.AreEqual(4, result); }
public void GcdEuclidianWithTwoNumbersZeroSecondTest() { //Arrange int a = 122, b = 0; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian); //Assert Assert.AreEqual(122, result); }
public void GcdEuclidianWithTwoNumbersOneTest() { //Arrange int a = 1, b = 256; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian); //Assert Assert.AreEqual(1, result); }
public void GcdEuclidianWithTwoNumbersZeroFirstTest() { //Arrange int a = 0, b = 256; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdEuclidian); //Assert Assert.AreEqual(256, result); }
public void GcdSteinsWithTwoNumbersOneTest() { //Arrange int a = 134, b = 1; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins); //Assert Assert.AreEqual(1, result); }
public void GcdSteinsWithTwoNumbersSecondZeroTest() { //Arrange int a = 134, b = 0; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins); //Assert Assert.AreEqual(134, result); }
public void GcdSteinsWithTwoNumbersFirsZeroTest() { //Arrange int a = 0, b = 256; //Act int result = FindGcd.Gcd(a, b, FindGcd.GcdSteins); //Assert Assert.AreEqual(256, result); }
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); }
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(); }
public int FindGcdSteinAlg(int a, int b) { return(FindGcd.Gcd(a, b, FindGcd.GcdSteins));; }
public int FindGcdEuclAlg(int a, int b) { return(FindGcd.Gcd(a, b, FindGcd.GcdEuclidian));; }