Beispiel #1
0
        public void EuclideanAlgorithm_80and120_40returned()
        {
            // arrange
            int firstNumber  = 80;
            int secondNumber = 120;
            int expected     = 40;

            // act
            int actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).result;

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public void EuclideanAlgorithm_minus27and99_9returned()
        {
            // arrange
            int firstNumber  = -27;
            int secondNumber = 99;
            int expected     = 9;

            // act
            int actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).result;

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #3
0
        public void BinaryGCD_1and27_1returned()
        {
            // arrange
            int firstNumber  = 1;
            int secondNumber = 27;
            int expected     = 1;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).result;

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public void EuclideanAlgorithm_7and5_1returned()
        {
            // arrange
            int firstNumber  = 7;
            int secondNumber = 5;
            int expected     = 1;

            // act
            int actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).result;

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #5
0
        public void EuclideanAlgorithmTimeCheck_minus99and0_0returned()
        {
            // arrange
            int firstNumber  = -99;
            int secondNumber = 0;
            int expected     = 0;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).algorithmExecutionTime;

            // assert;
            Assert.True(expected < actual);
        }
Beispiel #6
0
        public void BinaryGCD_minus18andMinus36_2returned()
        {
            // arrange
            int firstNumber  = -28;
            int secondNumber = -86;
            int expected     = 2;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber).result;

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #7
0
        public void EuclideanAlgorithm_0andMinus9and90_9returned()
        {
            // arrange
            int firstNumber  = 0;
            int secondNumber = -9;
            int thirdNumber  = 90;
            int expected     = 9;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber, thirdNumber);

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #8
0
        public void EuclideanAlgorithm_0and9and27andMinus8_1returned()
        {
            // arrange
            int firstNumber  = 0;
            int secondNumber = 9;
            int thirdNumber  = 27;
            int fourthNumber = -8;
            int expected     = 1;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber, thirdNumber, fourthNumber);

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #9
0
        public void EuclideanAlgorithm_0and0and0and0_0returned()
        {
            // arrange
            int firstNumber  = 0;
            int secondNumber = 0;
            int thirdNumber  = 0;
            int fourthNumber = 0;
            int expected     = 0;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber, thirdNumber, fourthNumber);

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #10
0
        public void EuclideanAlgorithm_128andMinus64and16and32_16returned()
        {
            // arrange
            int firstNumber  = 128;
            int secondNumber = -64;
            int thirdNumber  = 16;
            int fourthNumber = 32;
            int expected     = 16;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber, thirdNumber, fourthNumber);

            // assert;
            Assert.Equal(expected, actual);
        }
Beispiel #11
0
        public void EuclideanAlgorithm_minus117and3and9and0andMinus27_0returned()
        {
            // arrange
            int firstNumber       = -117;
            int secondNumber      = 3;
            int thirdNumber       = 9;
            int fourthNumber      = 0;
            int fifthNumberNumber = -27;
            int expected          = 3;

            // act
            double actual = CGD.EuclideanAlgorithm(firstNumber, secondNumber, thirdNumber, fourthNumber, fifthNumberNumber);

            // assert;
            Assert.Equal(expected, actual);
        }