예제 #1
0
        public void Tests(int x, int y, int d, int expected)
        {
            FrogJump jump   = new FrogJump();
            var      result = jump.Solution(x, y, d);

            Assert.AreEqual(expected, result);
        }
        public void FromJumpSolutionTest()
        {
            var frog   = new FrogJump();
            int result = frog.Solve(10, 85, 30);

            Assert.AreEqual(3, result);
        }
예제 #3
0
        public void FrogJump_Should_Process_Max_Values()
        {
            FrogJump subject = new FrogJump();

            int result = subject.solution(1, 10000000, 1);

            Assert.Equal(9999999, result);
        }
예제 #4
0
        public void FrogJump_Should_Process_Simple_Values()
        {
            FrogJump subject = new FrogJump();

            int result = subject.solution(10, 85, 30);

            Assert.Equal(3, result);
        }
예제 #5
0
 public void Setup()
 {
     _binaryGap          = new BinaryGap();
     _arrayRotation      = new ArrayRotation();
     _unpairedElements   = new UnpairedElements();
     _frogJump           = new FrogJump();
     _permMissingElement = new PermMissingElement();
     _tapeEquilibrium    = new TapeEquilibrium();
     _frogRiverOne       = new FrogRiverOne();
     _maxCounters        = new MaxCounters();
     _missingInteger     = new MissingInteger();
 }
예제 #6
0
        public void FrogJumpTest2()
        {
            //Arrange
            int X = 5; int Y = 1000000000; int D = 2;
            int expected = 499999998;
            int actual   = 0;

            //Act
            actual = FrogJump.solution2(X, Y, D);

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #7
0
        public void FrogJumpTest1()
        {
            //Arrange
            int X = 10; int Y = 85; int D = 30;
            int expected = 3;
            int actual   = 0;

            //Act
            actual = FrogJump.solution2(X, Y, D);

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #8
0
        public void Test()
        {
            FrogJump jump  = new FrogJump();
            int      count = jump.solution(10, 85, 30);

            Assert.AreEqual(3, count);

            count = jump.solution(1, 5, 2);
            Assert.AreEqual(2, count);

            count = jump.solution(5, 5, 2);
            Assert.AreEqual(0, count);
        }
예제 #9
0
        public void XSmallerThenYTest()
        {
            bool catchException = false;

            try
            {
                FrogJump.Solution(15, 4, 5);
            }
            catch (ArgumentException)
            {
                catchException = true;
            }

            if (catchException)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }
예제 #10
0
        public void NumberOutOfRangeTest()
        {
            int catchException = 0;

            try
            {
                FrogJump.Solution(int.MaxValue, 5, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            try
            {
                FrogJump.Solution(5, int.MaxValue, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            try
            {
                FrogJump.Solution(5, 5, int.MaxValue);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }


            try
            {
                FrogJump.Solution(0, 5, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(5, 0, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(0, 0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(5, 5, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            if (catchException == 7)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }
예제 #11
0
 public void ZeroJumpTest()
 {
     Assert.AreEqual(0, FrogJump.Solution(30, 30, 10));
 }
예제 #12
0
 public void OneJumpTest()
 {
     Assert.AreEqual(1, FrogJump.Solution(30, 60, 80));
 }
예제 #13
0
 public void WitheZeroStartTest()
 {
     Assert.AreEqual(128, FrogJump.Solution(1, 256, 2));
 }
예제 #14
0
 public void ExactlyOnPostionTest()
 {
     Assert.AreEqual(2, FrogJump.Solution(20, 50, 15));
 }
예제 #15
0
 public void ExampleTest()
 {
     Assert.AreEqual(3, FrogJump.Solution(10, 85, 30));
 }