func TestListClone(t *testing.T) {
	fmt.Println("ArrayList Clone")

	list = strings.NewArrayList()
	list.Add(arg1)
	list.Add(arg2)
	set1 := list.Clone()
	if set1.Size() != 2 {
		t.Errorf("Clone failed: size %v != 2\n", set1.Size())
	}
}
func TestListClear(t *testing.T) {
	fmt.Println("ArrayList Clear")

	list = strings.NewArrayList()
	list.Add(arg1)
	list.Add(arg2)
	list.Clear()
	if !list.Empty() {
		t.Errorf("Clear failed: Should be empty\n")
	}
}
func TestListSize(t *testing.T) {
	fmt.Println("ArrayList Size")

	list = strings.NewArrayList()
	list.Add(arg1)
	list.Add(arg2)

	if list.Size() != 2 {
		t.Errorf("Size failed: wrong size %v != 2\n", list.Size())
	}
}
func TestListInsert(t *testing.T) {
	fmt.Println("ArrayList Insert")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)

	v := arg4
	list.Insert(0, v)
	if list.Size() != 4 {
		t.Errorf("Wrong size %v != 4\n", list.Size())
	}

	r := list.Get(0)
	if r != v {
		t.Errorf("Insert: failed insert at 0\n")
	}

	v = arg4
	list.Insert(2, v)
	if list.Size() != 5 {
		t.Errorf("Wrong size %v != 5\n", list.Size())
	}

	r = list.Get(2)
	if r != v {
		t.Errorf("Insert: failed insert at 2\n")
	}

	v = arg4
	list.Insert(5, v)
	if list.Size() != 6 {
		t.Errorf("Wrong size %v != 6\n", list.Size())
	}

	r = list.Get(5)
	if r != v {
		t.Errorf("Insert: failed insert at 5\n")
	}

	v = arg2
	list.Insert(99, v)
	if list.Size() != 7 {
		t.Errorf("Wrong size %v != 7\n", list.Size())
	}

	r = list.Get(6)
	if r != v {
		t.Errorf("Insert: failed insert at 99\n")
	}
}
func TestListEmpty(t *testing.T) {
	fmt.Println("ArrayList Empty")

	list = strings.NewArrayList()

	if !list.Empty() {
		t.Errorf("Empty: should be empty\n")
	}

	list.Add(arg1)

	if list.Empty() {
		t.Errorf("Empty: should not be empty\n")
	}
}
func TestListSet(t *testing.T) {
	fmt.Println("ArrayList Set")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)

	v := "NewValue"
	r := list.Set(1, v)
	s := list.Get(1)
	if s != v {
		t.Errorf("Set failed: %v != %v\n", s, v)
	}
	if r != arg2 {
		t.Errorf("Set return failed: %v != %v\n", arg2, r)
	}
}
func TestListIndexOf(t *testing.T) {
	fmt.Println("ArrayList IndexOf")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)

	i := list.IndexOf(arg2)
	j := list.IndexOf(arg4)

	if i != 1 {
		t.Errorf("Wrong index: %v != 1\n", i)
	}
	if j != -1 {
		t.Errorf("Wrong index: %v != -1\n", j)
	}
}
func TestListContains(t *testing.T) {
	fmt.Println("ArrayList Contains")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)
	if list.Size() != 3 {
		t.Errorf("Wrong size %v != 3\n", list.Size())
	}

	expected := []string{arg1, arg2, arg3}
	for _, v := range list.Iterator() {
		if !list.Contains(v) {
			t.Errorf("Contains failed: %v not in %v", v, expected)
		}
	}

	v := arg4
	if list.Contains(v) {
		t.Errorf("Contains failed: %v found in %v", v, expected)
	}
}
func TestListDelete(t *testing.T) {
	fmt.Println("ArrayList Delete")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)

	list.Delete(5)
	if list.Size() != 3 {
		t.Errorf("Wrong size %v != 3\n", list.Size())
	}

	list.Delete(1)
	if list.Size() != 2 {
		t.Errorf("Wrong size %v != 2\n", list.Size())
	}

	r := list.Get(1)

	if r == arg2 {
		t.Errorf("Delete failed: still contains %v", r)
	}
}
func TestListIterator(t *testing.T) {
	fmt.Println("ArrayList Iterator")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)
	if list.Size() != 3 {
		t.Errorf("Wrong size %v != 3\n", list.Size())
	}

	found := 0
	expected := []string{arg1, arg2, arg3}
	for _, v := range list.Iterator() {
		for _, x := range expected {
			if x == v {
				found++
				break
			}
		}
	}
	if found != 3 {
		t.Errorf("Iterator failed: %v != %v", list.Iterator(), expected)
	}
}
func TestListRemove(t *testing.T) {
	fmt.Println("ArrayList Remove")

	list = strings.NewArrayList()
	list.Add(arg1, arg2, arg3)
	list.Remove(arg4) // ignores this correctly
	if list.Size() != 3 {
		t.Errorf("Wrong size %v != 3\n", list.Size())
	}

	v := arg2
	list.Remove(v)
	if list.Size() != 2 {
		t.Errorf("Wrong size %v != 2\n", list.Size())
	}
	if list.Contains(v) {
		t.Errorf("Remove failed: still contains %v", v)
	}

	list.Remove(arg1, arg3)
	if !list.Empty() {
		t.Errorf("Empty: should be empty\n")
	}
}