Exemplo n.º 1
0
        public void givenMixedCommandsThatMakeASquareReturnToStartingLocationGoingRight()
        {
            int[] location  = { 50, 50 };
            char  direction = 'e';

            int[]  grid     = { 100, 100 };
            string commands = "rfrfrfrf";

            int[] expected = new int[] { 50, 50 };
            int[] output   = new MarsRoverMovementClass().RovingRover(location, direction, grid, commands);

            Assert.AreEqual(expected, output);
        }
Exemplo n.º 2
0
        public void givenInputsWithCommandLeftReturnNewLocation()
        {
            int[] location  = { 50, 50 };
            char  direction = 'e';

            int[]  grid     = { 100, 100 };
            string commands = "fflf";

            int[] expected = new int[] { 49, 52 };
            int[] output   = new MarsRoverMovementClass().RovingRover(location, direction, grid, commands);

            Assert.AreEqual(expected, output);
        }
Exemplo n.º 3
0
        public void givenInputsThatRequireWrappingOnYAxisReturnCorrectLocation()
        {
            int[] location  = { 0, 0 };
            char  direction = 'n';

            int[]  grid     = { 100, 100 };
            string commands = "f";

            int[] expected = new int[] { 100, 0 };
            int[] output   = new MarsRoverMovementClass().RovingRover(location, direction, grid, commands);

            Assert.AreEqual(expected, output);
        }
Exemplo n.º 4
0
        public void givenInputsWitNoCommandsReturnStartingLocation()
        {
            int[] location  = { 0, 0 };
            char  direction = 'e';

            int[]  grid     = { 100, 100 };
            string commands = "ff";

            int[] expected = new int[] { 0, 2 };
            int[] output   = new MarsRoverMovementClass().RovingRover(location, direction, grid, commands);

            Assert.AreEqual(expected, output);
        }
Exemplo n.º 5
0
        public void givenAllInputsReturnAnIntArray()
        {
            int[] location  = { };
            char  direction = 'e';

            int[]  grid     = { };
            string commands = "";

            int[] expected = new int[] { };
            int[] output   = new MarsRoverMovementClass().RovingRover(location, direction, grid, commands);

            Assert.AreEqual(expected, output);
        }