From d2efeadbaa963c2a38a0670f3a555acb906689a3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 18 Mar 2022 07:28:56 -0700 Subject: Start test case implementation. --- testsuite.cwk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 testsuite.cwk (limited to 'testsuite.cwk') diff --git a/testsuite.cwk b/testsuite.cwk new file mode 100755 index 0000000..ce495d0 --- /dev/null +++ b/testsuite.cwk @@ -0,0 +1,23 @@ +#!./cppawk -f + +BEGIN { + RS = "--\n" + FS = ":\n" +} + +function runtest(id, code, output) +{ + print code > "script.sh" + print output > "output" + + if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { + printf("test %s failed\n", id) + } + + close("script.sh") + close("output") +} + +$1 { + runtest($1, $2, $3) +} -- cgit v1.2.3