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

Function TestHashMap_SetConcurrent

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

Source from the content-addressed store, hash-verified

378}
379
380func TestHashMap_SetConcurrent(t *testing.T) {
381 t.Parallel()
382 m := New[string, int]()
383
384 var wg sync.WaitGroup
385 for i := 0; i < 100; i++ {
386 wg.Add(1)
387
388 go func(i int) {
389 defer wg.Done()
390
391 m.Set(strconv.Itoa(i), i)
392
393 wg.Add(1)
394 go func(i int) {
395 defer wg.Done()
396
397 m.Get(strconv.Itoa(i))
398 }(i)
399 }(i)
400 }
401
402 wg.Wait()
403}
404
405func TestConcurrentInsertDelete(t *testing.T) {
406 t.Parallel()

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
AddMethod · 0.80
SetMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…