MCPcopy Index your code
hub / github.com/docker/docker-agent / TestSlice_Concurrent

Function TestSlice_Concurrent

pkg/concurrent/slice_test.go:140–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestSlice_Concurrent(t *testing.T) {
141 t.Parallel()
142 s := NewSlice[int]()
143 var wg sync.WaitGroup
144
145 for i := range 100 {
146 wg.Add(1)
147 go func(n int) {
148 defer wg.Done()
149 s.Append(n)
150 }(i)
151 }
152
153 wg.Wait()
154 require.Equal(t, 100, s.Length())
155}

Callers

nothing calls this directly

Calls 4

AddMethod · 0.65
WaitMethod · 0.65
AppendMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected