public void RotateMyArray(int[] expected, int[] input, int rotate)
        {
            CyclicRotation cyclicRotation = new CyclicRotation();

            int[] output = new int[input.Length];
            output = cyclicRotation.RotateArray(input, rotate);
            Assert.Equal(expected, output);
        }
예제 #2
0
        public void SingleRotationTest()
        {
            //Arrange
            int[] array         = { 1, 2, 3, 4, 5 };
            int   rotationTimes = 1;

            int[] expected = { 5, 1, 2, 3, 4 };
            int[] actual   = null;

            //Act
            actual = CyclicRotation.RotateArray(array, rotationTimes);

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void ZerosRotationTest()
        {
            //Arrange
            int[] array         = { 0, 0, 0 };
            int   rotationTimes = 1;

            int[] expected = { 0, 0, 0 };
            int[] actual   = null;

            //Act
            actual = CyclicRotation.RotateArray(array, rotationTimes);

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #4
0
        public void MoreTimesThanArrayLengthRotationTest()
        {
            //Arrange
            int[] array         = { 1, 2, 3, 4 };
            int   rotationTimes = 6;

            int[] expected = { 3, 4, 1, 2 };
            int[] actual   = null;

            //Act
            actual = CyclicRotation.RotateArray(array, rotationTimes);

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #5
0
        public void SameTimesAsArrayLengthRotationTest()
        {
            //Arrange
            int[] array         = { 1, 2, 3, 4, 5 };
            int   rotationTimes = 5;

            int[] expected = { 1, 2, 3, 4, 5 };
            int[] actual   = null;

            //Act
            actual = CyclicRotation.RotateArray(array, rotationTimes);

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