aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/tagenum.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/tagenum.zc')
-rw-r--r--tests/programs/tagenum.zc17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/programs/tagenum.zc b/tests/programs/tagenum.zc
index f438c5b..013f191 100644
--- a/tests/programs/tagenum.zc
+++ b/tests/programs/tagenum.zc
@@ -1,3 +1,6 @@
+namespace;
+include rt;
+
// tagged enums: a member can carry fields, a constructor builds it, and a
// switch matches on the member and binds its fields
enum shape { circle { int r; }, rect { int w; int h; }, dot };
@@ -15,12 +18,12 @@ fn main() {
shape* a = shape.circle(3);
shape* b = shape.rect(4, 5);
shape* c = shape.dot();
- put_n(area(a)); put_c(32);
- put_n(area(b)); put_c(32);
- put_n(area(c)); put_c(32);
- put_n(a.tag); put_c(32);
- put_n(b.tag); put_c(32);
- put_n(c.tag); put_c(10);
- free(d*a); free(d*b); free(d*c);
+ rt.put_n(area(a)); rt.put_c(32);
+ rt.put_n(area(b)); rt.put_c(32);
+ rt.put_n(area(c)); rt.put_c(32);
+ rt.put_n(a.tag); rt.put_c(32);
+ rt.put_n(b.tag); rt.put_c(32);
+ rt.put_n(c.tag); rt.put_c(10);
+ rt.free(d*a); rt.free(d*b); rt.free(d*c);
return 0;
}