MCPcopy
hub / github.com/aceld/zinx / TestIterCb

Function TestIterCb

zutils/shard_lock_map_test.go:276–295  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

274}
275
276func TestIterCb(t *testing.T) {
277 slm := NewShardLockMaps()
278
279 for i := 0; i < 100; i++ {
280 slm.Set(strconv.Itoa(i), TestUser{strconv.Itoa(i)})
281 }
282
283 counter := 0
284 slm.IterCb(func(key string, v interface{}) {
285 _, ok := v.(TestUser)
286 if !ok {
287 t.Error("Expecting an user object")
288 }
289
290 counter++
291 })
292 if counter != 100 {
293 t.Error("We should have counted 100 elements.")
294 }
295}
296
297func TestItems(t *testing.T) {
298 slm := NewShardLockMaps()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
IterCbMethod · 0.95
NewShardLockMapsFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected