github.com/iainanderson83/datastructures@v0.0.4-0.20191103204413-889e20b53bcf/linkedlist/linkedlist_test.go (about) 1 package linkedlist 2 3 import "testing" 4 5 func TestLinkedList(t *testing.T) { 6 l := newLinkedList() 7 8 l.Append(1) 9 l.Append(2) 10 l.Append(3) 11 12 front := l.Front() 13 if front.Val != 1 { 14 t.Fatalf("expected %d, got %d", 1, front.Val) 15 } 16 17 for front.Next != nil { 18 front = front.Next 19 } 20 21 if front.Val != 3 { 22 t.Fatalf("expected %d, got %d", 3, front.Val) 23 } 24 }