From 099ee729d440389da69fcc823b0244267d5cd4ef Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 5 Jul 2024 11:56:57 +0200 Subject: [PATCH] Added nested calls test --- .../programs/{register-overlap.q => chained-calls.q} | 0 tests/programs/multi-calls.q | 7 ------- tests/programs/nested-calls.q | 11 +++++++++++ tests/programs_test.go | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) rename tests/programs/{register-overlap.q => chained-calls.q} (100%) delete mode 100644 tests/programs/multi-calls.q create mode 100644 tests/programs/nested-calls.q diff --git a/tests/programs/register-overlap.q b/tests/programs/chained-calls.q similarity index 100% rename from tests/programs/register-overlap.q rename to tests/programs/chained-calls.q diff --git a/tests/programs/multi-calls.q b/tests/programs/multi-calls.q deleted file mode 100644 index bffc930..0000000 --- a/tests/programs/multi-calls.q +++ /dev/null @@ -1,7 +0,0 @@ -main() { - syscall(60, f(1) + f(2) + f(3)) -} - -f(x) { - return x + 1 -} \ No newline at end of file diff --git a/tests/programs/nested-calls.q b/tests/programs/nested-calls.q new file mode 100644 index 0000000..8844729 --- /dev/null +++ b/tests/programs/nested-calls.q @@ -0,0 +1,11 @@ +main() { + exit(f(f(f(1)))) +} + +exit(code) { + syscall(60, code) +} + +f(x) { + return x + 1 +} \ No newline at end of file diff --git a/tests/programs_test.go b/tests/programs_test.go index 2a785e8..cd70f45 100644 --- a/tests/programs_test.go +++ b/tests/programs_test.go @@ -16,10 +16,10 @@ var programs = []struct { ExpectedExitCode int }{ {"empty.q", "", 0}, - {"multi-calls.q", "", 9}, {"precedence.q", "", 10}, - {"register-overlap.q", "", 9}, {"square-sum.q", "", 25}, + {"chained-calls.q", "", 9}, + {"nested-calls.q", "", 4}, } func TestPrograms(t *testing.T) {