summaryrefslogtreecommitdiffstats
path: root/pp-test
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-11-17 23:31:25 +0100
committerFlorian Pritz <bluewind@xinu.at>2011-11-17 23:31:25 +0100
commit647ed2f2f70d91612e99c13e9bc931324c1a60ae (patch)
treeb93453576a78244234e30d4652aac0b243a320a6 /pp-test
parent8e42cf6d3095398a295aa5508d604dca0ede98e6 (diff)
downloadbin-647ed2f2f70d91612e99c13e9bc931324c1a60ae.tar.gz
bin-647ed2f2f70d91612e99c13e9bc931324c1a60ae.tar.xz
pp-test: if given, only run specific testcase
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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