MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestList_Push

Function TestList_Push

internal/utils/linkedlist/list_test.go:57–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestList_Push(t *testing.T) {
58 var list = linkedlist.NewList[int]()
59 list.Push(linkedlist.NewItem(1))
60 list.Push(linkedlist.NewItem(2))
61
62 var item3 = linkedlist.NewItem(3)
63 list.Push(item3)
64
65 var item4 = linkedlist.NewItem(4)
66 list.Push(item4)
67 list.Range(func(item *linkedlist.Item[int]) (goNext bool) {
68 t.Log(item.Value)
69 return true
70 })
71
72 t.Log("=== after push 3 ===")
73 list.Push(item3)
74 list.Range(func(item *linkedlist.Item[int]) (goNext bool) {
75 t.Log(item.Value)
76 return true
77 })
78
79 t.Log("=== after push 4 ===")
80 list.Push(item4)
81 list.Push(item3)
82 list.Push(item3)
83 list.Push(item3)
84 list.Push(item4)
85 list.Push(item4)
86 list.Range(func(item *linkedlist.Item[int]) (goNext bool) {
87 t.Log(item.Value)
88 return true
89 })
90
91 t.Log("=== after remove 3 ===")
92 list.Remove(item3)
93 list.Range(func(item *linkedlist.Item[int]) (goNext bool) {
94 t.Log(item.Value)
95 return true
96 })
97}
98
99func TestList_Shift(t *testing.T) {
100 var list = linkedlist.NewList[int]()

Callers

nothing calls this directly

Calls 5

NewItemFunction · 0.92
RangeMethod · 0.80
LogMethod · 0.80
RemoveMethod · 0.65
PushMethod · 0.45

Tested by

no test coverage detected