summaryrefslogtreecommitdiff
path: root/tests/features/test_vec_iter.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features/test_vec_iter.zc')
-rw-r--r--tests/features/test_vec_iter.zc19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/features/test_vec_iter.zc b/tests/features/test_vec_iter.zc
new file mode 100644
index 0000000..b7e8dcb
--- /dev/null
+++ b/tests/features/test_vec_iter.zc
@@ -0,0 +1,19 @@
+import "../../std/vec.zc"
+
+test "vec_int_iteration" {
+ var v = Vec<int>::new();
+ v.push(10);
+ v.push(20);
+ v.push(30);
+
+ var sum = 0;
+ for x in v {
+ sum = sum + x;
+ }
+
+ if (sum != 60) {
+ println "Expected 60, got {sum}";
+ exit(1);
+ }
+ v.free();
+}