-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulk_combiner_test.go
50 lines (43 loc) · 1002 Bytes
/
bulk_combiner_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import "testing"
func TestBulkCombine(t *testing.T) {
tests := []struct {
name string
addr []int
factor int
want []ReadLength
}{
{
"Test0",
[]int{1, 2, 6, 7, 8},
3,
[]ReadLength{{Start: 1, Last: 2}, {Start: 6, Last: 8}},
},
{
"Test1",
[]int{7, 6, 2, 8, 1},
3,
[]ReadLength{{Start: 1, Last: 2}, {Start: 6, Last: 8}},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
have := compute_reads(test.addr, test.factor)
if len(have) != len(test.want) {
t.Errorf("got wrong number of results for %s: got %d want %d", test.name, len(have), len(test.want))
return
}
for i, w := range test.want {
h := have[i]
if h.Last != w.Last {
t.Errorf("got wrong last for %s, %d: got %d want %d", test.name, i, h.Last, w.Last)
return
}
if h.Start != w.Start {
t.Errorf("got wrong start for %s, %d: got %d want %d", test.name, i, h.Start, w.Start)
return
}
}
})
}
}