MCPcopy Create free account
hub / github.com/egonelbre/exp / testIterator

Function testIterator

niterator/iterator_test.go:70–92  ·  view source on GitHub ↗
(t *testing.T, newiterator func(ap *shape.AP) Iterator)

Source from the content-addressed store, hash-verified

68}
69
70func 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
94func TestBasic(t *testing.T) {
95 testIterator(t, func(ap *shape.AP) Iterator { return basic.NewIterator(ap) })

Callers 15

TestBasicFunction · 0.85
TestInstructFunction · 0.85
TestOrdoneFunction · 0.85
TestPremulFunction · 0.85
TestOnearrFunction · 0.85
TestOnearrRevFunction · 0.85
TestOnearrRevAdvanceFunction · 0.85
TestOnearrRevSpecializeFunction · 0.85
TestOnearrPremulFunction · 0.85
TestSpecializeFunction · 0.85
TestUnrollFunction · 0.85

Calls 3

TotalSizeMethod · 0.80
RunMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected