コード例 #1
0
        public void TestMissingInteger()
        {
            int[] A        = new int[] { 1, 3, 6, 4, 1, 2 };
            int   expected = 5;
            int   actual   = Lessons.MissingInteger(A);

            Assert.AreEqual(expected, actual);

            A        = new int[] { 1, 2, 3 };
            expected = 4;
            actual   = Lessons.MissingInteger(A);

            Assert.AreEqual(expected, actual);

            A        = new int[] { -1, -3 };
            expected = 1;
            actual   = Lessons.MissingInteger(A);

            Assert.AreEqual(expected, actual);

            A        = new int[] { 2 };
            expected = 1;
            actual   = Lessons.MissingInteger(A);

            Assert.AreEqual(expected, actual);
        }