1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#!/bin/sh
TOOLDIR=../../tools/src
FORMAT_TOOL=$TOOLDIR/hfst-format
ext=""
lang=""
if [ "$1" = "--python" ]; then
TOOLDIR="./"
FORMAT_TOOL="python3 ./hfst-format.py"
ext=".py"
lang="python3 "
fi
TOOLS="hfst-disjunct hfst-concatenate hfst-conjunct hfst-subtract hfst-compose hfst-shuffle"
# TODO: hfst-compose-intersect, hfst-substitute, hfst-xfst?
NORMOPT="--silent"
STRICTOPT="--silent --do-not-convert"
for type1 in sfst ofst foma;
do
for type2 in sfst ofst foma;
do
for tool in $TOOLS;
do
tool=$lang$TOOLDIR/$tool$ext
# only test inputs that have mismatching types
if (test "$type1" != "$type2"); then
if (ls $tool > /dev/null 2> /dev/null); then
# echo "$tool"
if ($FORMAT_TOOL --list-formats | grep $type1 > /dev/null); then
if ($FORMAT_TOOL --list-formats | grep $type2 > /dev/null); then
# (1) two transducers
if test -f cat.$type1 -a -f dog.$type2; then
# echo " $type1, $type2"
# echo " normal"
if ! $tool $NORMOPT cat.$type1 dog.$type2 > test 2> /dev/null ; then
exit 1
fi
# echo " strict"
if $tool $STRICTOPT cat.$type1 dog.$type2 > test 2> /dev/null ; then
exit 1
fi
fi
if test -f cat.$type2 -a -f dog.$type1; then
# echo " $type2, $type1"
# echo " normal"
if ! $tool $NORMOPT cat.$type2 dog.$type1 > test 2> /dev/null ; then
exit 1
fi
# echo " strict"
if $tool $STRICTOPT cat.$type2 dog.$type1 > test 2> /dev/null ; then
exit 1
fi
fi
# (2) archives of transducers with equal length
if test -f cat.$type1 -a -f cat.$type2 -a -f dog.$type1 -a -f dog.$type2; then
cat cat.$type1 dog.$type1 > test1
cat cat.$type2 dog.$type2 > test2
# echo " archive $type1, archive $type2"
# echo " normal"
if ! $tool $NORMOPT test1 test2 > test 2> /dev/null ; then
exit 1
fi
# echo " strict"
if $tool $STRICTOPT test1 test2 > test 2> /dev/null ; then
exit 1
fi
fi
# (3) archives of transducers with different lengths
if test -f cat.$type1 -a -f cat.$type2 -a -f dog.$type1 -a -f dog.$type2; then
cat cat.$type1 dog.$type1 cat.$type1 dog.$type1 > test1
cat cat.$type2 > test2
# echo " archive $type1, $type2"
# echo " normal"
if ! $tool $NORMOPT test1 test2 > test 2> /dev/null ; then
exit 1
fi
# echo " strict"
if $tool $STRICTOPT test1 test2 > test 2> /dev/null ; then
exit 1
fi
fi
fi
fi
fi
fi
done
done
done
rm -f test test1 test2
|