@@ -12,10 +12,6 @@ type searchTest struct {
12
12
var searchTests = []searchTest {
13
13
//Sanity
14
14
{[]int {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }, 5 , 4 , "Sanity" },
15
- //First
16
- {[]int {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }, 1 , 0 , "First" },
17
- //Last
18
- {[]int {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }, 10 , 9 , "Last" },
19
15
//Absent
20
16
{[]int {1 , 4 , 5 , 6 , 7 , 10 }, 25 , - 1 , "Absent" },
21
17
//Empty slice
@@ -26,16 +22,7 @@ func TestBinarySearch(t *testing.T) {
26
22
for _ , test := range searchTests {
27
23
actual := binarySearch (test .data , test .key , 0 , len (test .data )- 1 )
28
24
if actual != test .expected {
29
- t .Errorf ("test %s failed: expected '%d', get '%d'" , test .name , test .expected , actual )
30
- }
31
- }
32
- }
33
-
34
- func TestIterBinarySearch (t * testing.T ) {
35
- for _ , test := range searchTests {
36
- actual := iterBinarySearch (test .data , test .key , 0 , len (test .data )- 1 )
37
- if actual != test .expected {
38
- t .Errorf ("test %s failed: expected '%d', get '%d'" , test .name , test .expected , actual )
25
+ t .Errorf ("test %s failed" , test .name )
39
26
}
40
27
}
41
28
}
@@ -44,7 +31,7 @@ func TestLinearSearch(t *testing.T) {
44
31
for _ , test := range searchTests {
45
32
actual := linearSearch (test .data , test .key )
46
33
if actual != test .expected {
47
- t .Errorf ("test %s failed: expected '%d', get '%d' " , test .name , test . expected , actual )
34
+ t .Errorf ("test %s failed" , test .name )
48
35
}
49
36
}
50
37
}
0 commit comments