Пример #1
0
func printSlice(slice *oslice.Slice) {
	fmt.Print("[")
	sep := ", "
	for i := 0; i < slice.Len(); i++ {
		if i+1 == slice.Len() {
			sep = "]\n"
		}
		fmt.Print(slice.At(i), sep)
	}
}
Пример #2
0
func checkList(slice *oslice.Slice, ints []int, t *testing.T) {
	if slice.Len() != len(ints) {
		t.Fatalf("slice.Len()=%d != %d", slice.Len(), len(ints))
	}
	for i := 0; i < slice.Len(); i++ {
		if !reflect.DeepEqual(slice.At(i), ints[i]) {
			t.Fatalf("mismtach At(%d) %v vs. %d", i, slice.At(i), ints[i])
		}
	}
}