summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2010-03-25 01:03:15 +0000
committerAdrian Thurston <thurston@complang.org>2010-03-25 01:03:15 +0000
commitf7b2d9ea1a5afee0e7b0b7bfc1581119f5577221 (patch)
treefe2612c37592ac4a7cfb3bff6df2dbc118eed30e /test
parent6fb7600c53244c6b9c73a88e1b5a5c5728bdd6eb (diff)
downloadcolm-f7b2d9ea1a5afee0e7b0b7bfc1581119f5577221.tar.gz
support multiple input files
Diffstat (limited to 'test')
-rw-r--r--test/TESTS27
-rwxr-xr-xtest/genmf70
-rw-r--r--test/python/Makefile33
-rw-r--r--test/python/TESTS1
-rw-r--r--test/python/python1.py.exp1
-rw-r--r--test/python/python1.py.in (renamed from test/python/input1.py)0
-rw-r--r--test/python/python2.py.exp1
-rw-r--r--test/python/python2.py.in (renamed from test/python/input2.py)0
-rw-r--r--test/python/python3.py.exp1
-rw-r--r--test/python/python3.py.in (renamed from test/python/input3.py)0
-rw-r--r--test/python/python4.py.exp3
-rw-r--r--test/python/python4.py.in (renamed from test/python/input4.py)0
12 files changed, 80 insertions, 57 deletions
diff --git a/test/TESTS b/test/TESTS
new file mode 100644
index 00000000..f6ef66b6
--- /dev/null
+++ b/test/TESTS
@@ -0,0 +1,27 @@
+backtrack1.lm
+backtrack2.lm
+dns.lm
+accum1.lm
+accum2.lm
+accum3.lm
+mutualrec.lm
+argv1.lm
+argv2.lm
+exit.lm
+rubyhere.lm
+translate1.lm
+translate2.lm
+construct1.lm
+construct2.lm
+construct3.lm
+treecmp1.lm
+context1.lm
+context2.lm
+context3.lm
+undofrag1.lm
+undofrag2.lm
+undofrag3.lm
+nestedcomm.lm
+reparse.lm
+btscan1.lm
+btscan2.lm
diff --git a/test/genmf b/test/genmf
index f6975ad5..9a0377bd 100755
--- a/test/genmf
+++ b/test/genmf
@@ -1,41 +1,47 @@
#!/bin/bash
#
-COLM="../colm/colm"
-TESTS="
- backtrack1.lm backtrack2.lm dns.lm accum1.lm accum2.lm accum3.lm
- mutualrec.lm argv1.lm argv2.lm exit.lm rubyhere.lm
- translate1.lm translate2.lm
- construct1.lm construct2.lm construct3.lm
- treecmp1.lm context1.lm context2.lm context3.lm
- undofrag1.lm undofrag2.lm undofrag3.lm
- nestedcomm.lm reparse.lm
- btscan1.lm btscan2.lm
-"
+TESTS="`cat TESTS`"
+GENMF="$0"
+COLM="`dirname $GENMF`/../colm/colm"
echo -n "TESTS ="
for t in $TESTS; do
echo " \\"
echo -n " $t"
done
-
echo
echo
-echo 'BINS = $(TESTS:%.lm=%.bin)'
-echo 'OUTS = $(TESTS:%.lm=%.out)'
-echo 'DIFFS = $(TESTS:%.lm=%.diff)'
+
+echo -n "DIFFS ="
+
+shopt -s nullglob
+for t in $TESTS; do
+ root=${t%.lm}
+ set -- ${root}*.in
+ if [ $# = 0 ]; then
+ echo " \\"
+ echo -n " $root.diff"
+ else
+ for i; do
+ echo " \\"
+ echo -n " ${i%.in}.diff"
+ done
+ fi
+done
echo
+echo
+
echo 'all: Makefile $(DIFFS)'
echo
-echo 'Makefile: genmf'
-echo ' ./genmf > Makefile'
+echo "Makefile: $GENMF"
+echo " $GENMF > Makefile"
echo
+
for t in $TESTS; do
root=${t%.lm}
-
- echo "$root.diff: $root.out $root.exp"
- echo " @ diff -u $root.exp $root.out > $root.diff || ( cat $root.diff; rm $root.diff )"
+ input=${root}*.in
# Are there any arguments.
if test -f $root.args; then
@@ -44,12 +50,28 @@ for t in $TESTS; do
args=""
fi
- echo "$root.out: $root.bin"
- if test -f "$root.in"; then
- echo " ./$root.bin $args < $root.in > $root.out"
- else
+ set -- ${root}*.in
+ if [ $# = 0 ]; then
+ echo "$root.diff: $root.out $root.exp"
+ echo " @diff -u $root.exp $root.out > $root.diff || ( cat $root.diff; rm $root.diff )"
+ echo
+ echo "$root.out: $root.bin"
echo " ./$root.bin $args > $root.out"
+ echo
+ else
+ for i; do
+ i=${i%.in}
+ echo "$i.diff: $i.out $i.exp"
+ echo " @diff -u $i.exp $i.out > $i.diff || ( cat $i.diff; rm $i.diff )"
+ echo
+ echo "$i.out: $root.bin"
+ echo " ./$root.bin $args < $i.in > $i.out"
+ echo
+ done
fi
+
echo "$root.bin: $t $COLM"
echo " $COLM $t"
done
+exit
+
diff --git a/test/python/Makefile b/test/python/Makefile
deleted file mode 100644
index 6ee0fde1..00000000
--- a/test/python/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright 2007 Adrian Thurston <thurston@complang.org>
-#
-
-# This file is part of Colm.
-#
-# Colm is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Colm is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Colm; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-SRC = $(wildcard *.lm)
-BIN = $(SRC:%.lm=%.bin)
-COLM = ../../colm/colm
-
-all: $(BIN)
-
-$(BIN): $(COLM)
-
-$(BIN): %.bin: %.lm
- $(COLM) $<
-
-clean:
- rm -f *.cpp *.bin
diff --git a/test/python/TESTS b/test/python/TESTS
new file mode 100644
index 00000000..6774269c
--- /dev/null
+++ b/test/python/TESTS
@@ -0,0 +1 @@
+python.lm
diff --git a/test/python/python1.py.exp b/test/python/python1.py.exp
new file mode 100644
index 00000000..2429110e
--- /dev/null
+++ b/test/python/python1.py.exp
@@ -0,0 +1 @@
+*** SUCCESS ***
diff --git a/test/python/input1.py b/test/python/python1.py.in
index 22ffd2e1..22ffd2e1 100644
--- a/test/python/input1.py
+++ b/test/python/python1.py.in
diff --git a/test/python/python2.py.exp b/test/python/python2.py.exp
new file mode 100644
index 00000000..2429110e
--- /dev/null
+++ b/test/python/python2.py.exp
@@ -0,0 +1 @@
+*** SUCCESS ***
diff --git a/test/python/input2.py b/test/python/python2.py.in
index 063825e1..063825e1 100644
--- a/test/python/input2.py
+++ b/test/python/python2.py.in
diff --git a/test/python/python3.py.exp b/test/python/python3.py.exp
new file mode 100644
index 00000000..2429110e
--- /dev/null
+++ b/test/python/python3.py.exp
@@ -0,0 +1 @@
+*** SUCCESS ***
diff --git a/test/python/input3.py b/test/python/python3.py.in
index 90ecf3f9..90ecf3f9 100644
--- a/test/python/input3.py
+++ b/test/python/python3.py.in
diff --git a/test/python/python4.py.exp b/test/python/python4.py.exp
new file mode 100644
index 00000000..14069de3
--- /dev/null
+++ b/test/python/python4.py.exp
@@ -0,0 +1,3 @@
+TARGET SIMPLE SLICING: [1:1]
+PRIMARY SIMPLE SLICING: [2:2]
+*** SUCCESS ***
diff --git a/test/python/input4.py b/test/python/python4.py.in
index 1a281c46..1a281c46 100644
--- a/test/python/input4.py
+++ b/test/python/python4.py.in