diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-19 12:53:47 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-19 12:53:47 +0000 |
| commit | 639c6ac65a1bd44b2ba0725fe7016a4920bf0950 (patch) | |
| tree | 47703f960633d3d4580022583134c28b96d5f36e /tests/features/test_vec_iter.zc | |
| parent | 526b7748cafcb5a00f8e30df88661f6059d79843 (diff) | |
Iterables and iterators :D
Diffstat (limited to 'tests/features/test_vec_iter.zc')
| -rw-r--r-- | tests/features/test_vec_iter.zc | 19 |
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(); +} |
