Ejemplo n.º 1
0
        public void RemoveDuplicates4Test()
        {
            var q    = new ArrayQ();
            var test = new RemoveDuplicateFuncTests(q.RemoveDuplicates4);

            RunRemoveDuplicateTests(test);
        }
Ejemplo n.º 2
0
        public void RunRemoveDuplicateTests(RemoveDuplicateFuncTests testDel)
        {
            var q        = new ArrayQ();
            var testcase = new int[] { 1, 1, 2 };
            var output   = testDel.Invoke(testcase);

            Assert.AreEqual(2, output);
            ValidateArrayElements(new int[] { 1, 2 }, GenerateResultIntOutput(testcase, output));

            testcase = new int[] { 0, 0, 1, 1, 1, 2, 2, 3, 3, 4 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(5, output);
            ValidateArrayElements(new int[] { 0, 1, 2, 3, 4 }, GenerateResultIntOutput(testcase, output));


            testcase = new[] { 1, 1 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(1, output);
            ValidateArrayElements(new int[] { 1 }, GenerateResultIntOutput(testcase, output));


            testcase = new[] { 1, 2, 2 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(2, output);
            ValidateArrayElements(new int[] { 1, 2 }, GenerateResultIntOutput(testcase, output));


            testcase = new[] { 1, 1, 2, 2 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(2, output);
            ValidateArrayElements(new int[] { 1, 2 }, GenerateResultIntOutput(testcase, output));


            testcase = new[] { 1, 2, 2, 3 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(3, output);
            ValidateArrayElements(new int[] { 1, 2, 3 }, GenerateResultIntOutput(testcase, output));

            testcase = new[] { 1, 1, 1 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(1, output);
            ValidateArrayElements(new int[] { 1 }, GenerateResultIntOutput(testcase, output));

            testcase = new[] { -3, -3, -2, -1, -1, 0, 0, 0, 0, 0 };
            output   = testDel.Invoke(testcase);
            Assert.AreEqual(4, output);
            ValidateArrayElements(new int[] { -3, -2, -1, 0 }, GenerateResultIntOutput(testcase, output));
        }