Exemplo n.º 1
0
        public void UT_ArrayLen2_ValFoundMiddleIndxPlusOne()
        {
            int[] arr    = new int[] { 3, 5, 9 };
            int   result = BinarySearchWithUT.Search(arr, 9);

            Assert.AreEqual(2, result);
        }
Exemplo n.º 2
0
        public void UT_ArrayLen1_ValNotFound()
        {
            int[] arr    = new int[] { 5 };
            int   result = BinarySearchWithUT.Search(arr, 3);

            Assert.AreEqual(-1, result);
        }
Exemplo n.º 3
0
        public void UT_ArrayLen2_ValFoundLast()
        {
            int[] arr    = new int[] { 3, 5 };
            int   result = BinarySearchWithUT.Search(arr, 5);

            Assert.AreEqual(1, result);
        }
Exemplo n.º 4
0
        public void UT_EmptyArray()
        {
            int[] arr    = new int[] {};
            int   result = BinarySearchWithUT.Search(arr, 5);

            Assert.AreEqual(-1, result);
        }