Example #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);
        }
Example #2
0
        public void TestThreeElementsArrayWithTarget2()
        {
            int[]     test2  = { 3, 5, 1 };
            const int target = 3;
            var       result = SearchinRotatedSortedArray.Search(test2, target);

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

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

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

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