aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/check.sh36
-rw-r--r--tests/empty.cu0
-rw-r--r--tests/import/priv_hello.cu1
-rw-r--r--tests/import/pub_hello.cu1
-rw-r--r--tests/import/pub_import_hello.cu1
-rw-r--r--tests/main.cu1
-rw-r--r--tests/priv_hello.cu7
-rw-r--r--tests/pub_hello.cu6
-rw-r--r--tests/pub_import_hello.cu6
9 files changed, 59 insertions, 0 deletions
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
--- /dev/null
+++ b/tests/empty.cu
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();
+}