MCPcopy
hub / github.com/cornelk/hashmap / TestSetString

Function TestSetString

hashmap_test.go:22–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestSetString(t *testing.T) {
23 t.Parallel()
24 m := New[int, string]()
25 elephant := "elephant"
26 monkey := "monkey"
27
28 m.Set(1, elephant) // insert
29 value, ok := m.Get(1)
30 assert.True(t, ok)
31 assert.Equal(t, elephant, value)
32
33 m.Set(1, monkey) // overwrite
34 value, ok = m.Get(1)
35 assert.True(t, ok)
36 assert.Equal(t, monkey, value)
37
38 assert.Equal(t, 1, m.Len())
39
40 m.Set(2, elephant) // insert
41 assert.Equal(t, 2, m.Len())
42 value, ok = m.Get(2)
43 assert.True(t, ok)
44 assert.Equal(t, elephant, value)
45}
46
47func TestSetUint8(t *testing.T) {
48 t.Parallel()

Callers

nothing calls this directly

Calls 6

TrueFunction · 0.92
EqualFunction · 0.92
NewFunction · 0.85
SetMethod · 0.80
GetMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…