MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / TestAdd

Function TestAdd

structure/linkedlist/cyclic_test.go:14–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12}
13
14func TestAdd(t *testing.T) {
15 list := NewCyclic[int]()
16 fillList(list, 3)
17
18 want := []any{1, 2, 3}
19 var got []any
20 var start *Node[int]
21 start = list.Head
22
23 for i := 0; i < list.Size; i++ {
24 got = append(got, start.Val)
25 start = start.Next
26 }
27 if !reflect.DeepEqual(got, want) {
28 t.Errorf("got: %v, want: %v", got, want)
29 }
30}
31
32func TestWalk(t *testing.T) {
33 list := NewCyclic[int]()

Callers

nothing calls this directly

Calls 1

fillListFunction · 0.85

Tested by

no test coverage detected