diff options
Diffstat (limited to 'tests/vec.c')
-rw-r--r-- | tests/vec.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/vec.c b/tests/vec.c index 4bc06e7..a84096c 100644 --- a/tests/vec.c +++ b/tests/vec.c @@ -10,10 +10,23 @@ int main() for (int i = 0; i < 1000000; ++i) { ints_append(&ints, i); } + assert(ints_len(&ints) == 1000000); for (int i = 0; i < 1000000; ++i) { int *v = ints_at(&ints, i); assert(v && *v == i); } + + int i = 0; + foreach(ints, iter, &ints) { + assert(iter && *iter == i); + i++; + } + + for (int i = 1000000 - 1; i >= 0; --i) { + ints_remove(&ints, i); + } + assert(ints_len(&ints) == 0); + ints_destroy(&ints); } |