(t *testing.T, newiterator func(ap *shape.AP) Iterator)
| 68 | } |
| 69 | |
| 70 | func testIterator(t *testing.T, newiterator func(ap *shape.AP) Iterator) { |
| 71 | t.Helper() |
| 72 | for api, testsize := range testSizes { |
| 73 | t.Run(testsize.Name, func(t *testing.T) { |
| 74 | verify := verifyIndex[api] |
| 75 | ap := testsize.AP |
| 76 | count := 0 |
| 77 | i := 0 |
| 78 | it := newiterator(ap) |
| 79 | for index, err := it.Next(); err == nil; index, err = it.Next() { |
| 80 | count++ |
| 81 | i++ |
| 82 | if verify[index] != i { |
| 83 | t.Fatalf("invalid at %d", index) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | if count != ap.TotalSize() { |
| 88 | t.Fatalf("invalid count: got %d expected %d", count, ap.TotalSize()) |
| 89 | } |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestBasic(t *testing.T) { |
| 95 | testIterator(t, func(ap *shape.AP) Iterator { return basic.NewIterator(ap) }) |
no test coverage detected