MCPcopy Create free account
hub / github.com/CPChain/chain / TestQueuePutAndGet

Function TestQueuePutAndGet

protocols/cpc/syncer/queue_test.go:8–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestQueuePutAndGet(t *testing.T) {
9 q := newQueue(2)
10
11 wg := sync.WaitGroup{}
12 defer wg.Wait()
13
14 wg.Add(1)
15
16 q.put(resultTask{"test"})
17 q.put(resultTask{"test1"})
18 q.put(resultTask{"test2"})
19
20 go func() {
21 defer wg.Done()
22 for !q.empty() {
23 task, _ := q.get()
24 t.Log(task.data.(string))
25 }
26 }()
27}
28
29func TestClearQueue(t *testing.T) {
30 q := newQueue(100)

Callers

nothing calls this directly

Calls 6

newQueueFunction · 0.85
WaitMethod · 0.80
AddMethod · 0.65
putMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected