ref: 2e8aa200b0f4aaaffd2daded19e1f64a2c019e8c
parent: a4cbb62ba8522be1d2a0b6aedeafd542fb22f713
author: Ori Bernstein <[email protected]>
date: Thu Jun 7 15:14:57 EDT 2012
Add a comment describing our testcase format.
--- a/test/test.sh
+++ b/test/test.sh
@@ -32,11 +32,11 @@
fi
}
-for i in `awk '/B/{print $2}' tests`; do
+for i in `awk '/^B/{print $2}' tests`; do
build $i
done
-for i in `awk '/F/{print $2}' tests`; do
+for i in `awk '/^F/{print $2}' tests`; do
build $i
if [ $? -ne '0' ]; then
echo "PASS: $i"
@@ -47,7 +47,7 @@
export IFS='
'
-for i in `awk '/B/{print $0}' tests`; do
+for i in `awk '/^B/{print $0}' tests`; do
tst=`echo $i | awk '{print $2}'`
type=`echo $i | awk '{print $3}'`
val=`echo $i | awk '{print $4}'`
--- a/test/tests
+++ b/test/tests
@@ -1,3 +1,18 @@
+# Format:
+# [B|F] testname [E|P] result
+# [B|F]: Compiler outcome.
+# B: Expect that this test will build.
+# F: Expect that this test will not build.
+# testname: Test case
+# The test that will run. We will try to
+# compile 'testname.myr' to 'testname',
+# and then execute it, verifying the result
+# [E|P]: Result type
+# E tells us that the result is an exit status
+# E tells us that the result output on stdout
+# result: Result value
+# What we compare with. This should be self-
+# evident.
B main E 0
B add E 53
B mul E 84
@@ -4,8 +19,8 @@
B div E 42
B mod E 6
B bsr E 5
-B struct1 E 12
-B struct E 42
+B struct1 E 12
+B struct E 42
B array E 7
B call E 42
B loop E 45