From 5b038666c3e911ffeb78a4d656044e5bd076705b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 23 Mar 2023 16:14:51 +0200 Subject: integrate parser work --- tests/check.sh | 36 ++++++++++++++++++++++++++++++++++++ tests/empty.cu | 0 tests/import/priv_hello.cu | 1 + tests/import/pub_hello.cu | 1 + tests/import/pub_import_hello.cu | 1 + tests/main.cu | 1 + tests/priv_hello.cu | 7 +++++++ tests/pub_hello.cu | 6 ++++++ tests/pub_import_hello.cu | 6 ++++++ 9 files changed, 59 insertions(+) create mode 100755 tests/check.sh create mode 100644 tests/empty.cu create mode 100644 tests/import/priv_hello.cu create mode 100644 tests/import/pub_hello.cu create mode 100644 tests/import/pub_import_hello.cu create mode 100644 tests/main.cu create mode 100644 tests/priv_hello.cu create mode 100644 tests/pub_hello.cu create mode 100644 tests/pub_import_hello.cu (limited to 'tests') diff --git a/tests/check.sh b/tests/check.sh new file mode 100755 index 0000000..397d36d --- /dev/null +++ b/tests/check.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +echo > check.log + +tests=0 +passed=0 +failed=0 + +for file in $(echo check/*.cu) +do + testcase=$(echo "$file" | cut -f 1 -d '.') + expected="$testcase".ok + args=$(test -e "$testcase".args && cat "$testcase".args) + + echo -n testing "$testcase"... + + cmd="./cu "$args" "$file" -o check/run && ./check/run" + + tests=$((tests + 1)) + if test "$output" = "$expected" + then + passed=$((passed + 1)) + echo ok + else + failed=$((failed + 1)) + echo fail + fi; + + if test -n "$VERBOSE" + then + echo "$cmd" + fi +done + +echo +echo tests "$tests", passed "$passed", failed "$failed" diff --git a/tests/empty.cu b/tests/empty.cu new file mode 100644 index 0000000..e69de29 diff --git a/tests/import/priv_hello.cu b/tests/import/priv_hello.cu new file mode 100644 index 0000000..970efcd --- /dev/null +++ b/tests/import/priv_hello.cu @@ -0,0 +1 @@ +hello(){} diff --git a/tests/import/pub_hello.cu b/tests/import/pub_hello.cu new file mode 100644 index 0000000..f26624e --- /dev/null +++ b/tests/import/pub_hello.cu @@ -0,0 +1 @@ +pub hello(){} diff --git a/tests/import/pub_import_hello.cu b/tests/import/pub_import_hello.cu new file mode 100644 index 0000000..4e6a851 --- /dev/null +++ b/tests/import/pub_import_hello.cu @@ -0,0 +1 @@ +pub import "pub_hello.cu"; diff --git a/tests/main.cu b/tests/main.cu new file mode 100644 index 0000000..05437c5 --- /dev/null +++ b/tests/main.cu @@ -0,0 +1 @@ +main(){} diff --git a/tests/priv_hello.cu b/tests/priv_hello.cu new file mode 100644 index 0000000..ef0f4c9 --- /dev/null +++ b/tests/priv_hello.cu @@ -0,0 +1,7 @@ +import "import/priv_hello.cu" + +main() +{ + /* expect this to fail */ + hello(); +} diff --git a/tests/pub_hello.cu b/tests/pub_hello.cu new file mode 100644 index 0000000..e6bea3b --- /dev/null +++ b/tests/pub_hello.cu @@ -0,0 +1,6 @@ +import "import/pub_hello.cu"; + +main() +{ + hello(); +} diff --git a/tests/pub_import_hello.cu b/tests/pub_import_hello.cu new file mode 100644 index 0000000..a0aeb31 --- /dev/null +++ b/tests/pub_import_hello.cu @@ -0,0 +1,6 @@ +import "import/pub_import_hello.cu"; + +main() +{ + hello(); +} -- cgit v1.3