diff --git a/slice_test.go b/slice_test.go index 915a1da..861c006 100644 --- a/slice_test.go +++ b/slice_test.go @@ -19,3 +19,39 @@ func TestAppend(t *testing.T) { t.Fatalf("len(*Slice) != 2") } } + +// TestAppendLength tests Slice.AppendLength. +func TestAppendLength(t *testing.T) { + s := &slice.Slice[int]{} + if n := s.AppendLength(1, 2, 3, 4); n != len(*s) { + t.Fatalf("len(*Slice) != 4") + } +} + +// TestBounds tests Slice.Bounds. +func TestBounds(t *testing.T) { + s := &slice.Slice[int]{} + if ok := s.Bounds(0); ok { + t.Fatalf("*Slice.Bounds() != false") + } + s.Append(1) + if ok := s.Bounds(0); !ok { + t.Fatalf("*Slice.Bounds() != true") + } +} + +// TestConcatenate tests Slice.Concatenate. +func TestConcatenate(t *testing.T) { + s := &slice.Slice[int]{} + s.Append(1) + s.Concatenate(&slice.Slice[int]{2, 3}) + if ok := (*s)[0] == 1; !ok { + t.Fatalf("*Slice[0] != 1") + } + if ok := (*s)[1] == 2; !ok { + t.Fatalf("*Slice[1] != 2") + } + if ok := (*s)[2] == 3; !ok { + t.Fatalf("*Slice[2] != 3") + } +}