github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/utils/synclist/list_test.go (about) 1 package synclist 2 3 import "testing" 4 5 func TestSyncList(t *testing.T) { 6 l := New[int]() 7 8 l.PushFront(0) 9 l.PushFront(-1) 10 l.PushBack(1) 11 12 b := l.Back() 13 p := l.Front() 14 15 for { 16 if b == nil { 17 break 18 } 19 t.Log(b.Value) 20 b = b.Prev() 21 } 22 23 for { 24 if p == nil { 25 break 26 } 27 t.Log(p.Value) 28 p = p.Next() 29 } 30 }