From 567eed5e49a927a31b2692c586da1246519fb1a9 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 6 Mar 2024 14:50:50 -0500 Subject: Some basic tests --- tests/test_basic.tnsl | 3 +++ tests/test_funcall.tnsl | 13 +++++++++++++ tests/test_method | 23 +++++++++++++++++++++++ tests/test_pointer.tnsl | 6 ++++++ tests/test_struct.tnsl | 14 ++++++++++++++ tests/test_variable.tnsl | 4 ++++ 6 files changed, 63 insertions(+) create mode 100644 tests/test_basic.tnsl create mode 100644 tests/test_funcall.tnsl create mode 100644 tests/test_method create mode 100644 tests/test_pointer.tnsl create mode 100644 tests/test_struct.tnsl create mode 100644 tests/test_variable.tnsl (limited to 'tests') diff --git a/tests/test_basic.tnsl b/tests/test_basic.tnsl new file mode 100644 index 0000000..6ff0a72 --- /dev/null +++ b/tests/test_basic.tnsl @@ -0,0 +1,3 @@ +/; main [int] + return 69 +;/ diff --git a/tests/test_funcall.tnsl b/tests/test_funcall.tnsl new file mode 100644 index 0000000..d741031 --- /dev/null +++ b/tests/test_funcall.tnsl @@ -0,0 +1,13 @@ +/; ret_a [int] + return 9 +;/ + +/; ret_b (int i) [int] + return i +;/ + +/; main [int] + + int i = ret_a() + return i + ret_b(60) +;/ diff --git a/tests/test_method b/tests/test_method new file mode 100644 index 0000000..0f79400 --- /dev/null +++ b/tests/test_method @@ -0,0 +1,23 @@ +struct Vector { + ~void data, + int + size, + count, + _el_sz +} + +/; method Vector + + /; init + self.size = 69 + ;/ +;/ + +/; main [int] + + Vector a + a.init() + + return a.size + +;/ diff --git a/tests/test_pointer.tnsl b/tests/test_pointer.tnsl new file mode 100644 index 0000000..5fe1a36 --- /dev/null +++ b/tests/test_pointer.tnsl @@ -0,0 +1,6 @@ +/; main [int] + int i = 0 + ~int j = ~i + j` = 69 + return i +;/ diff --git a/tests/test_struct.tnsl b/tests/test_struct.tnsl new file mode 100644 index 0000000..59a4b78 --- /dev/null +++ b/tests/test_struct.tnsl @@ -0,0 +1,14 @@ +struct Vector { + ~void data, + int + size, + count, + _el_sz +} + +/; main [int] + Vector a + a.size = 69 + return a.size +;/ + diff --git a/tests/test_variable.tnsl b/tests/test_variable.tnsl new file mode 100644 index 0000000..08bf0f8 --- /dev/null +++ b/tests/test_variable.tnsl @@ -0,0 +1,4 @@ +/; main [int] + int i = 69 + return i +;/ -- cgit v1.2.3