MCPcopy Create free account
hub / github.com/LyricTian/queue / TestQueue

Function TestQueue

chan_queue_test.go:10–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestQueue(t *testing.T) {
11 q := NewQueue(2, 10)
12 q.Run()
13
14 var count int64
15
16 for i := 0; i < 10; i++ {
17 job := NewJob("foo", func(v interface{}) {
18 atomic.AddInt64(&count, 1)
19 })
20 q.Push(job)
21 }
22
23 q.Terminate()
24
25 if count != 10 {
26 t.Error(count)
27 }
28}
29
30func TestSyncQueue(t *testing.T) {
31 q := NewQueue(1, 2)

Callers

nothing calls this directly

Calls 6

RunMethod · 0.95
PushMethod · 0.95
TerminateMethod · 0.95
NewQueueFunction · 0.85
NewJobFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected