aboutsummaryrefslogtreecommitdiff
path: root/docs/history/15-o3/code/tests/arrays.zc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/history/15-o3/code/tests/arrays.zc')
-rw-r--r--docs/history/15-o3/code/tests/arrays.zc24
1 files changed, 0 insertions, 24 deletions
diff --git a/docs/history/15-o3/code/tests/arrays.zc b/docs/history/15-o3/code/tests/arrays.zc
deleted file mode 100644
index f8d46d8..0000000
--- a/docs/history/15-o3/code/tests/arrays.zc
+++ /dev/null
@@ -1,24 +0,0 @@
-// growable arrays and fixed ones
-struct point { int x, y; };
-fn main()
-{
- let before = live_objects();
- {
- []int a = new([]int);
- for (int i = 0; i < 100; i++) push(a, i * i);
- putn(len(a)); putc(' '); putn(cap(a)); putc(' '); putn(a[99]); putc(' ');
- putn(pop(a)); putc(' '); putn(len(a)); putc(' ');
- resize(a, 3); putn(len(a)); putc(' '); putn(a[2]); putc(' ');
- fixed []int f = new(fixed []int, 5);
- f[4] = 7; putn(f[4] + len(f)); putc(' ');
- []point ps = new([]point, 2);
- ps[1].y = 9; resize(ps, 10); putn(ps[1].y + len(ps)); putc(' ');
- [8]int st; putn(len(st)); putc(' ');
- []*point owned = new([]*point);
- for (int i = 0; i < 20; i++) { *point p = new(point); p.x = i; push(owned, d*p); }
- putn(owned[19].x); putc(' ');
- putn(live_objects() - before); putc(10);
- }
- putn(live_objects() - before); putc(10);
- return 0;
-}