summaryrefslogtreecommitdiffstats
path: root/pp-test
diff options
context:
space:
mode:
Diffstat (limited to 'pp-test')
-rwxr-xr-xpp-test30
1 files changed, 21 insertions, 9 deletions
diff --git a/pp-test b/pp-test
index 736aede..e84ecb7 100755
--- a/pp-test
+++ b/pp-test
@@ -1,6 +1,6 @@
#!/bin/sh
-prog="$1"
+prog="$1"; shift
realpath="$(readlink -f "$prog")"
workdir=${realpath%/*}
basepath=${workdir##*/}
@@ -9,13 +9,25 @@ cd $workdir
javac $prog.java || exit 1
-i=1
-
-while [[ -e "$basepath.i$i" ]]; do
- echo "testing $basepath.i$i"
- java -ea "$prog" < "$basepath.i$i" > tmpout
+testcase() {
+ if [[ ! -e "$basepath.i$i" ]]; then
+ return 1
+ fi
+ echo "testing $basepath.i$1"
+ java -ea "$prog" < "$basepath.i$1" > tmpout
dos2unix tmpout
- diff -Nua "$basepath.o$i" tmpout
+ diff -Nua "$basepath.o$1" tmpout
rm tmpout
- ((i++));
-done
+}
+
+if (($#)); then
+ for i in "$@"; do
+ testcase $i
+ done
+else
+ i=1
+ while true; do
+ testcase $i || break
+ ((i++))
+ done
+fi