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

Function TestDelete

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

Source from the content-addressed store, hash-verified

230}
231
232func TestDelete(t *testing.T) {
233 t.Parallel()
234 m := New[int, string]()
235 elephant := "elephant"
236 monkey := "monkey"
237
238 deleted := m.Del(1)
239 assert.False(t, deleted)
240
241 m.Set(1, elephant)
242 m.Set(2, monkey)
243
244 deleted = m.Del(0)
245 assert.False(t, deleted)
246 deleted = m.Del(3)
247 assert.False(t, deleted)
248 assert.Equal(t, 2, m.Len())
249
250 deleted = m.Del(1)
251 assert.True(t, deleted)
252 deleted = m.Del(1)
253 assert.False(t, deleted)
254 deleted = m.Del(2)
255 assert.True(t, deleted)
256 assert.Equal(t, 0, m.Len())
257}
258
259func TestRange(t *testing.T) {
260 t.Parallel()

Callers

nothing calls this directly

Calls 7

FalseFunction · 0.92
EqualFunction · 0.92
TrueFunction · 0.92
NewFunction · 0.85
DelMethod · 0.80
SetMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…