コード例 #1
0
        public void TestEightElementsArrayWithTarget()
        {
            int[]     test2  = { 4, 5, 6, 7, 8, 1, 2, 3 };
            const int target = 8;
            var       result = SearchinRotatedSortedArray.Search(test2, target);

            Assert.IsTrue(result == 4);
        }
コード例 #2
0
        public void TestThreeElementsArrayWithTarget2()
        {
            int[]     test2  = { 3, 5, 1 };
            const int target = 3;
            var       result = SearchinRotatedSortedArray.Search(test2, target);

            Assert.IsTrue(result == 0);
        }
コード例 #3
0
        public void TestTwoElementsArrayNoTarget()
        {
            int[]     test2  = { 1, 3 };
            const int target = 0;
            var       result = SearchinRotatedSortedArray.Search(test2, target);

            Assert.IsTrue(result == -1);
        }
コード例 #4
0
        public void TestSigleElementArrayNoTarget()
        {
            int[]     test   = { 1 };
            const int target = 0;

            var result = SearchinRotatedSortedArray.Search(test, target);

            Assert.IsTrue(result == -1);
        }