From 74babfe81b7a1acb84d83735e089ac95481ceb74 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Mon, 11 Mar 2024 05:49:19 -0400 Subject: Slightly better function calling --- tests/test_controll.tnsl | 12 ++++++++++++ tests/test_funcall_2.tnsl | 12 ++++++++++++ tests/test_funcall_3.tnsl | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 tests/test_controll.tnsl create mode 100644 tests/test_funcall_2.tnsl create mode 100644 tests/test_funcall_3.tnsl (limited to 'tests') diff --git a/tests/test_controll.tnsl b/tests/test_controll.tnsl new file mode 100644 index 0000000..47ff241 --- /dev/null +++ b/tests/test_controll.tnsl @@ -0,0 +1,12 @@ +/; main [int] + + /; if (false) + return 1 + ;; else if (1 == 0) + return 2 + ;; else + return 69 + ;/ + + return 0 +;/ diff --git a/tests/test_funcall_2.tnsl b/tests/test_funcall_2.tnsl new file mode 100644 index 0000000..3bf746c --- /dev/null +++ b/tests/test_funcall_2.tnsl @@ -0,0 +1,12 @@ +/; ret_a [int] + return 9 +;/ + +/; ret_b (int i, j) [int] + return i + j +;/ + +/; main [int] + int i = ret_a() + return ret_b(60, i) +;/ diff --git a/tests/test_funcall_3.tnsl b/tests/test_funcall_3.tnsl new file mode 100644 index 0000000..b974ea7 --- /dev/null +++ b/tests/test_funcall_3.tnsl @@ -0,0 +1,16 @@ +struct Str { + int i, j +} + +/; strout [Str] + Str out + out.i = 60 + out.j = 9 + return out +;/ + +/; main [int] + Str out + out = strout() + return out.j + out.i +;/ -- cgit v1.2.3