diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 03:09:23 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 03:09:23 +0300 |
| commit | 1b58c86d6856339d71bfc124fc8f48fbd2b09fd0 (patch) | |
| tree | a638375b37aa294c1b2e4f6f6623345f6b5a4559 /tests/struct_call_ref.ek | |
| parent | 2ef60c2a9520b02256c6f5051468aedbfb69683b (diff) | |
| download | ek-1b58c86d6856339d71bfc124fc8f48fbd2b09fd0.tar.gz ek-1b58c86d6856339d71bfc124fc8f48fbd2b09fd0.zip | |
initial working struct call tests pass
Diffstat (limited to 'tests/struct_call_ref.ek')
| -rw-r--r-- | tests/struct_call_ref.ek | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/struct_call_ref.ek b/tests/struct_call_ref.ek new file mode 100644 index 0000000..a4d38bc --- /dev/null +++ b/tests/struct_call_ref.ek @@ -0,0 +1,29 @@ +typedef i27 {} +typedef i9 {} + +typedef int_pair { + i27 a; + i27 b; +} + +extern _putchar(i9 c); + +add_int_pair_self(*int_pair a, *int_pair b) +{ + a*.a = a*.a + b*.a; + a*.b = a*.b + b*.b; +} + +main() +{ + mut a = int_pair!{.a = 1, .b = 2}; + mut b = int_pair!{.a = 3, .b = 4}; + + add_int_pair_self(a&, b&); + + _putchar('0' + a.a as i9); + _putchar('0' + a.b as i9); + _putchar('0' + b.a as i9); + _putchar('0' + b.b as i9); + _putchar('\n'); +} |
