Beispiel #1
0
        public void GetNodByStein_params6_9_12_Expected_3()
        {
            NOD nodEvklid = new NOD();
            int actual    = nodEvklid.GetNodByStein(6, 9, 12);
            int expected  = 3;

            Assert.AreEqual(actual, expected);
        }
Beispiel #2
0
        public void TestMethod2()
        {
            int a   = 300181;
            int b   = 223744;
            int nod = 19;
            int ans = NOD.EuclidAlg(a, b);

            Assert.AreEqual(nod, ans);
        }
Beispiel #3
0
        public void BinEvklidNODArray7_3_12Exp1()
        {
            NOD nod = new NOD(new[] { 7, 3, 12 });
            int exp = 1;
            //Act
            uint fact = nod.BinaryGCD();

            //Assert
            Assert.AreEqual(exp, fact);
        }
Beispiel #4
0
        public void TestMethod3()
        {
            int a   = 585;
            int b   = 81;
            int c   = 189;
            int nod = 9;
            int ans = NOD.EuclidAlg(a, b, c);

            Assert.AreEqual(nod, ans);
        }
Beispiel #5
0
        public void TestMethod1()
        {
            int a   = 322328;
            int b   = 122120;
            int nod = 344;
            int ans = NOD.EuclidAlg(a, b);


            Assert.AreEqual(nod, ans);
        }
Beispiel #6
0
        public void TestNODBin()
        {
            int a        = 16;
            int b        = 8;
            int expected = 8;

            NOD n      = new NOD();
            int actual = n.nodBin(a, b);

            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void TestMethod4()
        {
            int a   = 78;
            int b   = 294;
            int c   = 570;
            int d   = 36;
            int nod = 6;
            int ans = NOD.EuclidAlg(a, b, c, d);

            Assert.AreEqual(nod, ans);
        }
Beispiel #8
0
        public void BinEvklidNODArray12_Negative69_27Exp3()
        {
            //Arrange
            NOD nod = new NOD(new[] { 12, -69, 27 });
            int exp = 3;
            //Act
            uint fact = nod.BinaryGCD();

            //Assert
            Assert.AreEqual(exp, fact);
        }
Beispiel #9
0
        public void EvklidNODArray12_69_27Exp3()
        {
            //Arrange
            NOD nod = new NOD(new [] { 12, 69, 27 });
            int exp = 3;
            //Act
            int fact = nod.EvklidNOD();

            //Assert
            Assert.AreEqual(exp, fact);
        }
Beispiel #10
0
        public void TestNODEv2()
        {
            int a        = 45;
            int b        = 15;
            int expected = 15;

            NOD n      = new NOD();
            int actual = n.nodEv(a, b);

            Assert.AreEqual(expected, actual);
        }
Beispiel #11
0
        public void EvklidNODArray12_0_27ExpNegative1()
        {
            //Arrange
            NOD nod = new NOD(new[] { 12, 0, 27 });
            int exp = -1;
            //Act
            int fact = nod.EvklidNOD();

            //Assert
            Assert.AreEqual(exp, fact);
        }
Beispiel #12
0
        public void BinEvklidNODArray12_0_0ExpNegative12()
        {
            //Arrange
            NOD nod = new NOD(new[] { 12, 0, 0 });

            int exp = 12;
            //Act
            uint fact = nod.BinaryGCD();

            //Assert
            Assert.AreEqual(exp, fact);
        }
Beispiel #13
0
        public void TestNODEv4()
        {
            int a        = 45;
            int b        = 15;
            int c        = 10;
            int d        = 5;
            int expected = 5;

            NOD n      = new NOD();
            int actual = n.nodEv(a, b, c, d);

            Assert.AreEqual(expected, actual);
        }
Beispiel #14
0
        public void TestNODEv5()
        {
            int a        = 55;
            int b        = 121;
            int c        = 11;
            int d        = 22;
            int e        = 33;
            int expected = 11;

            NOD n      = new NOD();
            int actual = n.nodEv(a, b, c, d, e);

            Assert.AreEqual(expected, actual);
        }
        public void TestMethodGcdStein()
        {
            double time;
            int    a, b, gcd;

            for (int i = 0; i < 100; i++)
            {
                time = 0;
                a    = rand.Next(-1000, 1001);
                b    = rand.Next(-1000, 1001);

                gcd = NOD.findGcdStein(a, b, ref time);

                Assert.IsTrue(CheckResult(gcd, a, b));
            }
        }
        public void TestMethodGcdEuclid()
        {
            double time;
            int    a, b, c, d, e, gcd;

            for (int i = 0; i < 100; i++)
            {
                time = 0;
                a    = rand.Next(-1000, 1001);
                b    = rand.Next(-1000, 1001);
                c    = rand.Next(-1000, 1001);
                d    = rand.Next(-1000, 1001);
                e    = rand.Next(-1000, 1001);

                gcd = NOD.findGcdEuclid(a, b, c, d, e, ref time);

                Assert.IsTrue(CheckResult(gcd, a, b, c, d, e));
            }
        }
Beispiel #17
0
 public long Stein_3Args(long a, long b, long c)
 {
     return(NOD.Stein(a, b));
 }
Beispiel #18
0
 public long Stein_2Args(long a, long b)
 {
     return(NOD.Stein(a, b));
 }
Beispiel #19
0
 public void Euclid_ManyArgs_ThrowsArgumentOutOfRangeException(long a, long b, long c, long d, long e)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => NOD.Euclid(a, b, c, d, e));
 }
Beispiel #20
0
 public long Euclid_ManyArgs(long a, long b, long c, long d, long e)
 {
     return(NOD.Euclid(a, b, c, d, e));
 }
Beispiel #21
0
 public void Euclid_3Args_ThrowsArgumentOutOfRangeException(long a, long b, long c)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => NOD.Euclid(a, b, c));
 }
Beispiel #22
0
 public long Euclid_3Args(long a, long b, long c)
 {
     return(NOD.Euclid(a, b));
 }
Beispiel #23
0
 public void SteinAlgorithmArgumentNullTests()
 => Assert.Throws <ArgumentNullException>(() => NOD.SteinAlgorithm(null));
Beispiel #24
0
 public int EuclidAlgorithmTests(params int[] values)
 => NOD.EuclidAlgorithm(values);
Beispiel #25
0
 public int SteinAlgorithmTests(int value1, int value2, int value3)
 => NOD.SteinAlgorithm(value1, value2, value3);
Beispiel #26
0
 public int SteinAlgorithmTests(params int[] values)
 => NOD.SteinAlgorithm(values);
Beispiel #27
0
 public void Stein_3Args_ThrowsArgumentOutOfRangeException(long a, long b, long c)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => NOD.Stein(a, b, c));
 }
Beispiel #28
0
 public long Euclid_2Args(long a, long b)
 {
     return(NOD.Euclid(a, b));
 }
Beispiel #29
0
 public long Stein_ManyArgs(long a, long b, long c, long d, long e)
 {
     return(NOD.Stein(a, b, c, d, e));
 }
Beispiel #30
0
 public void SteinAlgorithmArgumentOutOfRangeTests(int value)
 => Assert.Throws <ArgumentOutOfRangeException>(() => NOD.SteinAlgorithm(value));