summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-11 05:49:19 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-11 05:49:19 -0400
commit74babfe81b7a1acb84d83735e089ac95481ceb74 (patch)
treeddb578d9943f507d889e8ff9d64f2127a51c792b /tests
parente89df8aad15c2d9a86f9a5bc04657fded6494f17 (diff)
Slightly better function calling
Diffstat (limited to 'tests')
-rw-r--r--tests/test_controll.tnsl12
-rw-r--r--tests/test_funcall_2.tnsl12
-rw-r--r--tests/test_funcall_3.tnsl16
3 files changed, 40 insertions, 0 deletions
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
+;/