Move testsuite/compiler/canonical on level up, update test script

This commit is contained in:
John J. Camilleri
2021-06-30 13:47:15 +02:00
parent 0f5be0bbaa
commit 4436cb101e
22 changed files with 42 additions and 23 deletions

42
testsuite/canonical/run.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env sh
FAILURES=0
# https://github.com/GrammaticalFramework/gf-core/issues/100
stack run -- --batch --output-format=canonical_gf grammars/PhrasebookBul.gf
stack run -- --batch canonical/PhrasebookBul.gf
if [ $? -ne 0 ]; then
echo "Canonical grammar doesn't compile: FAIL"
FAILURES=$((FAILURES+1))
else
echo "Canonical grammar compiles: OK"
fi
# https://github.com/GrammaticalFramework/gf-core/issues/101
stack run -- --batch --output-format=canonical_gf grammars/PhrasebookGer.gf
for s in c2 objCtrl; do
grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null
if [ $? -ne 1 ]; then
echo "Canonical grammar contains `$s`: FAIL"
FAILURES=$((FAILURES+1))
else
echo "Canonical grammar does not contain `$s`: OK"
fi
done
# https://github.com/GrammaticalFramework/gf-core/issues/102
stack run -- --batch --output-format=canonical_gf grammars/FoodsFin.gf
diff canonical/FoodsFin.gf gold/FoodsFin.gf
if [ $? -ne 0 ]; then
echo "Canonical grammar doesn't match gold version: FAIL"
FAILURES=$((FAILURES+1))
else
echo "Canonical grammar matches gold version: OK"
fi
if [ $FAILURES -ne 0 ]; then
echo "Failures: $FAILURES"
exit 1
else
echo "All tests passed"
fi

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env sh
# https://github.com/GrammaticalFramework/gf-core/issues/100
stack run -- --batch --output-format=canonical_gf PhrasebookBul.gf
stack run -- --batch canonical/PhrasebookBul.gf
# https://github.com/GrammaticalFramework/gf-core/issues/101
stack run -- --batch --output-format=canonical_gf PhrasebookGer.gf
for s in c2 objCtrl; do
grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null
if [ $? -ne 1 ]; then
echo "$s found"
exit 1
fi
done
# https://github.com/GrammaticalFramework/gf-core/issues/102
stack run -- --batch --output-format=canonical_gf FoodsFin.gf
diff canonical/FoodsFin.gf ./FoodsFin.gf.gold
if [ $? -ne 0 ]; then
echo "Compiled grammar doesn't match gold version"
exit 1
fi