@@ -35,6 +35,28 @@ public static void FindIndex_ItemPresentInSpecificCase_IndexCorrect(int[] arr, i
3535 arr [ index ] . Should ( ) . Be ( present ) ;
3636 }
3737
38+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } , 3 ) ] // Item in left segment (< indexBinary)
39+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } , 5 ) ] // Item at binary index
40+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } , 8 ) ] // Item in right segment (> indexBinary)
41+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } , 1 ) ] // Item at start
42+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } , 10 ) ] // Item at end
43+ [ TestCase ( new [ ] { 1 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 } , 20 ) ] // Non-uniform distribution, interpolation < binary
44+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 100 } , 100 ) ] // Non-uniform distribution, interpolation > binary
45+ [ TestCase ( new [ ] { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 } , 50 ) ] // Uniform spacing
46+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } , 7 ) ] // Larger array
47+ [ TestCase ( new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } , 15 ) ] // Larger array, right side
48+ public static void FindIndex_ItemPresentDeterministic_IndexCorrect ( int [ ] arr , int present )
49+ {
50+ // Arrange
51+ var searcher = new FastSearcher ( ) ;
52+
53+ // Act
54+ var index = searcher . FindIndex ( arr , present ) ;
55+
56+ // Assert
57+ arr [ index ] . Should ( ) . Be ( present ) ;
58+ }
59+
3860 [ Test ]
3961 public static void FindIndex_ItemPresentInArrayOfDuplicates_IndexCorrect ( )
4062 {
0 commit comments