Ejemplo n.º 1
0
        public void RotateSmallArray_Success()
        {
            var arr    = new int[] { -1 };
            var steps  = 2;
            var rotate = new RotateArray(arr, steps);

            rotate.PerformRotationWithAdditionalSpace();

            Assert.True(CheckArrayEquality(new int[] { -1 }, arr));
        }
Ejemplo n.º 2
0
        public void RotateFirstArray_Success()
        {
            var arr    = new int[] { 1, 2, 3, 4, 5, 6, 7 };
            var steps  = 3;
            var rotate = new RotateArray(arr, steps);

            rotate.PerformRotationInPlace();


            Assert.True(CheckArrayEquality(new int[] { 5, 6, 7, 1, 2, 3, 4 }, arr));
        }
Ejemplo n.º 3
0
        public void RotateSecondArray_Cyclic_Success()
        {
            var arr    = new int[] { -1, -100, 3, 99 };
            var steps  = 2;
            var rotate = new RotateArray(arr, steps);

            rotate.PerformRotationWithCyclicRotation();


            Assert.True(CheckArrayEquality(new int[] { 3, 99, -1, -100 }, arr));
        }