Beispiel #1
0
        public void MoveZeroesTest()
        {
            int[]      arr = { 1, 2, 3, 0, 0, 2, 4, 2, 0, 4 };
            MoveZeroes mz  = new MoveZeroes();

            mz.Move_zeroes(arr);
            CollectionAssert.AreEqual(new int[] { 1, 2, 3, 2, 4, 2, 4, 0, 0, 0 }, arr);
        }
Beispiel #2
0
        public void MoveZeroesSolution()
        {
            var nums = new[] { 0, 1, 0, 3, 12 };
            var res  = new[] { 1, 3, 12, 0, 0 };

            var testClass = new MoveZeroes();

            testClass.Solution(nums);
            Assert.AreEqual(nums, res);
        }
Beispiel #3
0
        public void moveZeroesTest()
        {
            foreach (MoveZeroesTestData testData in TestDataList)
            {
                Console.WriteLine("Test input: " + string.Join(",", testData.InputArray));
                MoveZeroes.moveZeroes(testData.InputArray);
                Console.WriteLine("Test output: " + string.Join(",", testData.InputArray));

                CollectionAssert.AreEqual(testData.InputArray, testData.OutputArray);
            }
        }
Beispiel #4
0
 public void Test()
 {
     Assert.AreEqual(new int[] { 1, 2, 1, 1, 3, 1, 0, 0, 0, 0 },
                     MoveZeroes.Do(new int[] { 1, 2, 0, 1, 0, 1, 0, 3, 0, 1 }));
 }
Beispiel #5
0
 void InternalTest(int[] nums, int[] expected)
 {
     MoveZeroes.Solve(nums);
     AssertHelper.AssertArrays(expected, nums);
 }
Beispiel #6
0
 public void BeforeEach()
 {
     MoveZeroes = new MoveZeroes();
 }
Beispiel #7
0
 public void ZeroMoverTest()
 {
     Assert.Equal(new int[] { 1, 2, 1, 1, 3, 1, 0, 0, 0, 0 }, MoveZeroes.Move(new int[] { 1, 2, 0, 1, 0, 1, 0, 3, 0, 1 }));
 }