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

Function TestIntMap_PutCompact

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

Source from the content-addressed store, hash-verified

50}
51
52func TestIntMap_PutCompact(t *testing.T) {
53 var a = assert.NewAssertion(t)
54
55 var m = syncutils.NewIntMap[int, string]()
56 m.Put(1, "a")
57 m.Put(1, "b")
58 a.IsTrue(m.Get(1) == "b")
59
60 m.PutCompact(1, "c", func(oldV string, newV string) string {
61 return oldV + newV
62 })
63
64 a.IsTrue(m.Get(1) == "bc")
65}
66
67func TestIntMap_ForEachRead(t *testing.T) {
68 var m = syncutils.NewIntMap[int, string]()

Callers

nothing calls this directly

Calls 3

PutCompactMethod · 0.80
PutMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected