MCPcopy Index your code
hub / github.com/VirusTotal/vt-cli / TestPQueue

Function TestPQueue

utils/pqueue_test.go:22–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestPQueue(t *testing.T) {
23 pq := utils.PQueue{}
24
25 heap.Init(&pq)
26 heap.Push(&pq, utils.PQueueNode{Priority: 4, Data: "4"})
27 heap.Push(&pq, utils.PQueueNode{Priority: 0, Data: "0"})
28 heap.Push(&pq, utils.PQueueNode{Priority: 2, Data: "2"})
29
30 if heap.Pop(&pq).(utils.PQueueNode).Data.(string) != "0" {
31 t.Errorf("")
32 }
33
34 heap.Push(&pq, utils.PQueueNode{Priority: 1, Data: "1"})
35
36 if heap.Pop(&pq).(utils.PQueueNode).Data.(string) != "1" {
37 t.Errorf("")
38 }
39
40 if heap.Pop(&pq).(utils.PQueueNode).Data.(string) != "2" {
41 t.Errorf("")
42 }
43
44 if heap.Pop(&pq).(utils.PQueueNode).Data.(string) != "4" {
45 t.Errorf("")
46 }
47
48 if pq.Len() != 0 {
49 t.Errorf("")
50 }
51
52}

Callers

nothing calls this directly

Calls 3

LenMethod · 0.95
PushMethod · 0.80
PopMethod · 0.80

Tested by

no test coverage detected