|
|
@@ -15,9 +15,9 @@ public class BinarySearchTest {
|
|
15
|
15
|
public void findsAValueInAnArrayWithOneElement() {
|
|
16
|
16
|
List<Integer> listOfUnitLength = Collections.singletonList(6);
|
|
17
|
17
|
|
|
18
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(listOfUnitLength);
|
|
|
18
|
+ BinarySearch<Integer> search = new BinarySearch<>(listOfUnitLength);
|
|
19
|
19
|
|
|
20
|
|
- assertEquals(0, sut.indexOf(6));
|
|
|
20
|
+ assertEquals(0, search.indexOf(6));
|
|
21
|
21
|
}
|
|
22
|
22
|
|
|
23
|
23
|
@Ignore("Remove to run test")
|
|
|
@@ -27,9 +27,9 @@ public class BinarySearchTest {
|
|
27
|
27
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
28
|
28
|
);
|
|
29
|
29
|
|
|
30
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
30
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
31
|
31
|
|
|
32
|
|
- assertEquals(3, sut.indexOf(6));
|
|
|
32
|
+ assertEquals(3, search.indexOf(6));
|
|
33
|
33
|
}
|
|
34
|
34
|
|
|
35
|
35
|
@Ignore("Remove to run test")
|
|
|
@@ -39,9 +39,9 @@ public class BinarySearchTest {
|
|
39
|
39
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
40
|
40
|
);
|
|
41
|
41
|
|
|
42
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
42
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
43
|
43
|
|
|
44
|
|
- assertEquals(0, sut.indexOf(1));
|
|
|
44
|
+ assertEquals(0, search.indexOf(1));
|
|
45
|
45
|
}
|
|
46
|
46
|
|
|
47
|
47
|
@Ignore("Remove to run test")
|
|
|
@@ -51,9 +51,9 @@ public class BinarySearchTest {
|
|
51
|
51
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
52
|
52
|
);
|
|
53
|
53
|
|
|
54
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
54
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
55
|
55
|
|
|
56
|
|
- assertEquals(6, sut.indexOf(11));
|
|
|
56
|
+ assertEquals(6, search.indexOf(11));
|
|
57
|
57
|
}
|
|
58
|
58
|
|
|
59
|
59
|
@Ignore("Remove to run test")
|
|
|
@@ -63,9 +63,9 @@ public class BinarySearchTest {
|
|
63
|
63
|
Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634)
|
|
64
|
64
|
);
|
|
65
|
65
|
|
|
66
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedListOfOddLength);
|
|
|
66
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedListOfOddLength);
|
|
67
|
67
|
|
|
68
|
|
- assertEquals(9, sut.indexOf(144));
|
|
|
68
|
+ assertEquals(9, search.indexOf(144));
|
|
69
|
69
|
}
|
|
70
|
70
|
|
|
71
|
71
|
@Ignore("Remove to run test")
|
|
|
@@ -75,9 +75,9 @@ public class BinarySearchTest {
|
|
75
|
75
|
Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377)
|
|
76
|
76
|
);
|
|
77
|
77
|
|
|
78
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedListOfEvenLength);
|
|
|
78
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedListOfEvenLength);
|
|
79
|
79
|
|
|
80
|
|
- assertEquals(5, sut.indexOf(21));
|
|
|
80
|
+ assertEquals(5, search.indexOf(21));
|
|
81
|
81
|
}
|
|
82
|
82
|
|
|
83
|
83
|
@Ignore("Remove to run test")
|
|
|
@@ -87,9 +87,9 @@ public class BinarySearchTest {
|
|
87
|
87
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
88
|
88
|
);
|
|
89
|
89
|
|
|
90
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
90
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
91
|
91
|
|
|
92
|
|
- assertEquals(-1, sut.indexOf(7));
|
|
|
92
|
+ assertEquals(-1, search.indexOf(7));
|
|
93
|
93
|
}
|
|
94
|
94
|
|
|
95
|
95
|
@Ignore("Remove to run test")
|
|
|
@@ -99,9 +99,9 @@ public class BinarySearchTest {
|
|
99
|
99
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
100
|
100
|
);
|
|
101
|
101
|
|
|
102
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
102
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
103
|
103
|
|
|
104
|
|
- assertEquals(-1, sut.indexOf(0));
|
|
|
104
|
+ assertEquals(-1, search.indexOf(0));
|
|
105
|
105
|
}
|
|
106
|
106
|
|
|
107
|
107
|
@Ignore("Remove to run test")
|
|
|
@@ -111,9 +111,9 @@ public class BinarySearchTest {
|
|
111
|
111
|
Arrays.asList(1, 3, 4, 6, 8, 9, 11)
|
|
112
|
112
|
);
|
|
113
|
113
|
|
|
114
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(sortedList);
|
|
|
114
|
+ BinarySearch<Integer> search = new BinarySearch<>(sortedList);
|
|
115
|
115
|
|
|
116
|
|
- assertEquals(-1, sut.indexOf(13));
|
|
|
116
|
+ assertEquals(-1, search.indexOf(13));
|
|
117
|
117
|
}
|
|
118
|
118
|
|
|
119
|
119
|
@Ignore("Remove to run test")
|
|
|
@@ -121,8 +121,8 @@ public class BinarySearchTest {
|
|
121
|
121
|
public void nothingIsIncludedInAnEmptyArray() {
|
|
122
|
122
|
List<Integer> emptyList = Collections.emptyList();
|
|
123
|
123
|
|
|
124
|
|
- BinarySearch<Integer> sut = new BinarySearch<>(emptyList);
|
|
|
124
|
+ BinarySearch<Integer> search = new BinarySearch<>(emptyList);
|
|
125
|
125
|
|
|
126
|
|
- assertEquals(-1, sut.indexOf(1));
|
|
|
126
|
+ assertEquals(-1, search.indexOf(1));
|
|
127
|
127
|
}
|
|
128
|
128
|
}
|