|
|
|
@ -6,8 +6,9 @@ package arraylist
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/emirpasic/gods/utils"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/emirpasic/gods/utils"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestListAdd(t *testing.T) {
|
|
|
|
@ -25,6 +26,33 @@ func TestListAdd(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestListIndexOf(t *testing.T) {
|
|
|
|
|
list := New()
|
|
|
|
|
|
|
|
|
|
expectedIndex := -1
|
|
|
|
|
if index := list.IndexOf("a"); index != expectedIndex{
|
|
|
|
|
t.Errorf("Got %v expected %v",index,expectedIndex)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list.Add("a")
|
|
|
|
|
list.Add("b", "c")
|
|
|
|
|
|
|
|
|
|
expectedIndex = 0
|
|
|
|
|
if index := list.IndexOf("a"); index != expectedIndex{
|
|
|
|
|
t.Errorf("Got %v expected %v",index,expectedIndex)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expectedIndex = 1
|
|
|
|
|
if index := list.IndexOf("b"); index != expectedIndex{
|
|
|
|
|
t.Errorf("Got %v expected %v",index,expectedIndex)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expectedIndex = 2
|
|
|
|
|
if index := list.IndexOf("c"); index != expectedIndex{
|
|
|
|
|
t.Errorf("Got %v expected %v",index,expectedIndex)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestListRemove(t *testing.T) {
|
|
|
|
|
list := New()
|
|
|
|
|
list.Add("a")
|
|
|
|
|