@@ -53,25 +53,36 @@ func TestShapeutilRangeIteratorNext(t *testing.T) {
53
53
// Create an index with one point each on CellID faces 0, 1, and 2.
54
54
index := makeShapeIndex ("0:0 | 0:90 | 90:0 # #" )
55
55
it := newRangeIterator (index )
56
+ itCount := 0
57
+ next := func () {
58
+ itCount ++
59
+ it .next ()
60
+ if it .done () {
61
+ t .Errorf ("There should be 3 items in the index but there were only %d" , itCount )
62
+ }
63
+ }
56
64
57
65
if got , want := it .cellID ().Face (), 0 ; got != want {
58
66
t .Errorf ("it.CellID().Face() = %v, want %v" , got , want )
59
67
}
60
- it . next ()
68
+ next ()
61
69
62
70
if got , want := it .cellID ().Face (), 1 ; got != want {
63
71
t .Errorf ("it.CellID().Face() = %v, want %v" , got , want )
64
72
}
65
- it . next ()
73
+ next ()
66
74
67
75
if got , want := it .cellID ().Face (), 2 ; got != want {
68
76
t .Errorf ("it.CellID().Face() = %v, want %v" , got , want )
69
77
}
70
- it .next ()
71
78
79
+ it .next ()
72
80
if ! it .done () {
73
81
t .Errorf ("iterator over index of three items should be done after 3 calls to next" )
74
82
}
83
+ if got , want := it .cellID (), SentinelCellID ; got != want {
84
+ t .Errorf ("it.CellID() = %v, want %v" , got , want )
85
+ }
75
86
}
76
87
77
88
func TestShapeutilRangeIteratorEmptyIndex (t * testing.T ) {
0 commit comments