MCPcopy Index your code
hub / github.com/aceld/zinx / TestBufferedIterator

Function TestBufferedIterator

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

Source from the content-addressed store, hash-verified

237}
238
239func TestBufferedIterator(t *testing.T) {
240 slm := NewShardLockMaps()
241
242 for i := 0; i < 100; i++ {
243 slm.Set(strconv.Itoa(i), TestUser{strconv.Itoa(i)})
244 }
245
246 counter := 0
247 for item := range slm.IterBuffered() {
248 val := item.Val
249
250 if val == nil {
251 t.Error("Expecting an object.")
252 }
253 counter++
254 }
255
256 if counter != 100 {
257 t.Error("We should have counted 100 elements.")
258 }
259
260}
261
262func TestClear(t *testing.T) {
263 slm := NewShardLockMaps()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
IterBufferedMethod · 0.95
NewShardLockMapsFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected