diff options
Diffstat (limited to 'test/complit.go')
-rw-r--r-- | test/complit.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/complit.go b/test/complit.go index f5f7aca9d..8dfc71dcb 100644 --- a/test/complit.go +++ b/test/complit.go @@ -31,6 +31,18 @@ func eq(a []*R) { } } +func teq(t *T, n int) { + for i := 0; i < n; i++ { + if t == nil || t.i != i { + panic("bad") + } + t = t.next + } + if t != nil { + panic("bad") + } +} + type P struct { a, b int } @@ -46,6 +58,9 @@ func main() { var tp *T tp = &T{0, 7.2, "hi", &t} + tl := &T{i: 0, next: &T{i: 1, next: &T{i: 2, next: &T{i: 3, next: &T{i: 4}}}}} + teq(tl, 5) + a1 := []int{1, 2, 3} if len(a1) != 3 { panic("a1") @@ -93,6 +108,7 @@ func main() { } eq([]*R{itor(0), itor(1), itor(2), itor(3), itor(4), itor(5)}) + eq([]*R{{0}, {1}, {2}, {3}, {4}, {5}}) p1 := NewP(1, 2) p2 := NewP(1, 2) |