aboutsummaryrefslogtreecommitdiff
path: root/tests/struct_call_ref.ek
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-04-15 03:09:23 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-04-15 03:09:23 +0300
commit1b58c86d6856339d71bfc124fc8f48fbd2b09fd0 (patch)
treea638375b37aa294c1b2e4f6f6623345f6b5a4559 /tests/struct_call_ref.ek
parent2ef60c2a9520b02256c6f5051468aedbfb69683b (diff)
downloadek-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.ek29
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');
+}