MCPcopy
hub / github.com/canopy-network/canopy / validateIterators

Function validateIterators

store/store_test.go:145–152  ·  view source on GitHub ↗
(t *testing.T, prefix string, expectedKeys []string, iterators ...lib.IteratorI)

Source from the content-addressed store, hash-verified

143}
144
145func validateIterators(t *testing.T, prefix string, expectedKeys []string, iterators ...lib.IteratorI) {
146 for _, it := range iterators {
147 for i := 0; it.Valid(); func() { i++; it.Next() }() {
148 got, wanted := string(it.Key()), prefix+string(lib.JoinLenPrefix([]byte(expectedKeys[i])))
149 require.Equal(t, wanted, got, fmt.Sprintf("wanted %s got %s", wanted, got))
150 }
151 }
152}
153
154// bulkSetPrefixedKV sets multiple single segment length prefixed key-value pairs in the store
155func bulkSetPrefixedKV(t *testing.T, store lib.WStoreI, prefix string, keyValue ...string) {

Callers 4

TestIteratorCommitBasicFunction · 0.85
TestIteratorBasicFunction · 0.85
TestIteratorWithDeleteFunction · 0.85

Calls 5

JoinLenPrefixFunction · 0.92
EqualMethod · 0.80
ValidMethod · 0.65
NextMethod · 0.65
KeyMethod · 0.65

Tested by

no test coverage detected