diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-26 18:18:48 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-26 18:18:48 -0400 |
commit | 6a342bfa6392df7b91ae82cb950a2248cfa61ab9 (patch) | |
tree | a17152669a1c1e15eb3a6000baa93b144ca53881 /tests | |
parent | b3b39e6c33a0bbb7d5e47221e902700a5cf5b685 (diff) |
added more stuff in use test because of used struct members
Diffstat (limited to 'tests')
-rw-r--r-- | tests/use.toc | 36 | ||||
-rw-r--r-- | tests/use_expected | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/use.toc b/tests/use.toc index 98e9221..ec062c2 100644 --- a/tests/use.toc +++ b/tests/use.toc @@ -9,11 +9,41 @@ Point ::= struct { a ::= 3; } +Point3D ::= struct { + use point: Point; + z: int; + +} + +Point4D ::= struct { + use p3: Point3D; + w: int; +} + +Foo ::= struct { + f: f32; +} + +Bar ::= struct { + use foo: Foo; + use p4: Point4D; +} + + + make_point ::= fn (x_: int, y_: int) use p: Point { x = x_+a; y = y_+a; } +make_bar ::= fn (x_ := 0, y_ := 0, z_ := 0, w_ := 0, f_ := 0.0) use b: Bar { + x = x_; + y = y_; + z = z_; + b.p4.w = w_; + b.f = f_; +} + main ::= fn() { use io; @@ -42,4 +72,10 @@ main ::= fn() { puts(""); } dels(ps); + b := make_bar(5, 8, 13, 12); + puti(b.x); + puti(b.y); + puti(b.z); + puti(b.w); + } diff --git a/tests/use_expected b/tests/use_expected index d47a933..0470d66 100644 --- a/tests/use_expected +++ b/tests/use_expected @@ -4,3 +4,7 @@ 8 12 9 14 10 16 +5 +8 +13 +12 |