Esempio n. 1
0
        public void SearchTargetInteger_ArrayDoesNotContainTargetInteger_Minus1(int target)
        {
            var searchInteger = new SearchInteger();

            int[] sortedNumbers = { 1, 3, 7, 9, 15 };

            var result = searchInteger.chop(target, sortedNumbers);

            Assert.Equal(-1, result);
        }
Esempio n. 2
0
        public void SearchInteger_EmptyArray_Minus1()
        {
            var searchInteger = new SearchInteger();

            int[] sortedNumbers = { };

            var result = searchInteger.chop(1, sortedNumbers);

            Assert.Equal(-1, result);
        }
Esempio n. 3
0
        public void SearchTargetInteger_ArrayDoesContainTargetInteger_Index(int target, int expectedIndex)
        {
            var searchInteger = new SearchInteger();

            int[] sortedNumbers = { 1, 3, 7, 9, 15 };

            var result = searchInteger.chop(target, sortedNumbers);

            Assert.Equal(expectedIndex, result);
        }