mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
44 lines
566 B
Go
44 lines
566 B
Go
package list_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/charlienet/go-mixed/collections/list"
|
|
)
|
|
|
|
func TestNewArrayList(t *testing.T) {
|
|
l := list.NewArrayList(1, 2, 3)
|
|
|
|
l.ForEach(func(i int) {
|
|
t.Log(i)
|
|
})
|
|
|
|
}
|
|
|
|
func TestArrayPushBack(t *testing.T) {
|
|
l := list.NewArrayList[int]()
|
|
|
|
l.PushBack(1)
|
|
l.PushBack(2)
|
|
l.PushBack(3)
|
|
|
|
l.ForEach(func(i int) {
|
|
t.Log(i)
|
|
})
|
|
}
|
|
|
|
func TestArrayPushFront(t *testing.T) {
|
|
l := list.NewArrayList[int]()
|
|
|
|
l.PushFront(1)
|
|
l.PushFront(2)
|
|
l.PushFront(3)
|
|
|
|
l.PushBack(99)
|
|
l.PushBack(88)
|
|
|
|
l.ForEach(func(i int) {
|
|
t.Log(i)
|
|
})
|
|
}
|