MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestIntMap_ForEachWrite

Function TestIntMap_ForEachWrite

internal/utils/sync/map_int_test.go:80–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestIntMap_ForEachWrite(t *testing.T) {
81 var m = syncutils.NewIntMap[int, string]()
82 for i := 0; i < 100; i++ {
83 m.Put(i, "v"+types.String(i))
84 }
85
86 t.Log(m.Len())
87
88 m.ForEachRead(func(k int, v string) {
89 t.Log(k, v)
90 m.DeleteUnsafe(k)
91 })
92 t.Log(m.Len(), "elements left")
93}
94
95func BenchmarkNewIntMap(b *testing.B) {
96 var m = syncutils.NewIntMap[int, *stats.BandwidthStat]()

Callers

nothing calls this directly

Calls 6

LogMethod · 0.80
ForEachReadMethod · 0.80
DeleteUnsafeMethod · 0.80
PutMethod · 0.45
StringMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected