Browse Source

Add OPTIONS argument to test_phon() and use it instead of test_commandlineoptions()

master
Valdis Vitolins 4 years ago
parent
commit
899b268468
2 changed files with 7 additions and 29 deletions
  1. 5
    5
      tests/cmd_options.test
  2. 2
    24
      tests/common

+ 5
- 5
tests/cmd_options.test View File



# tested in other tests: --ipa, -x, -X, -v, -m, -f, -q, --compile, --compile-debug, --compile-mbrola, --compile-intonations, --compile-phonemes # tested in other tests: --ipa, -x, -X, -v, -m, -f, -q, --compile, --compile-debug, --compile-mbrola, --compile-intonations, --compile-phonemes


test_commandlineoptions en "Capitals (sound)" "-k 1" "_#X1T'aI _#X1'Es Iz a# _#X1t'Es _#X1t'i: fO@ _#X1k'apIt@Lz" "ThiS is a TesT for Capitals"
test_commandlineoptions en "Capitals (word)" "-k 2" "k,ap@-t@L T'aI k,ap@-t@L 'Es Iz a# k,ap@-t@L t'Es k,ap@-t@L t'i: fO@ k,ap@-t@L k'apIt@Lz" "ThiS is a TesT for Capitals"
test_commandlineoptions en "Separator" "--sep=q" "hq@qlq'oU wq'3:qlqd" "hello world"
test_commandlineoptions en "Linelength" "-l 15" "wi:; 'A@
test_phon en "_#X1T'aI _#X1'Es Iz a# _#X1t'Es _#X1t'i: fO@ _#X1k'apIt@Lz" "ThiS is a TesT for Capitals" "Capitals (sound)" "-k 1"
test_phon en "k,ap@-t@L T'aI k,ap@-t@L 'Es Iz a# k,ap@-t@L t'Es k,ap@-t@L t'i: fO@ k,ap@-t@L k'apIt@Lz" "ThiS is a TesT for Capitals" "Capitals (word)" "-k 2"
test_phon en "hq@qlq'oU wq'3:qlqd" "hello world" "Separator" "--sep=q"
test_phon en "wi:; 'A@
wi:; A@ t'EstIN wi:; A@ t'EstIN
wi:; A@ t'EstIN l'aInlENT wi:; A@ t'EstIN l'aInlENT l'aIk D'Is" "We are wi:; A@ t'EstIN l'aInlENT wi:; A@ t'EstIN l'aInlENT l'aIk D'Is" "We are
We are testing We are testing
We are testing linelength We are testing linelength
We are testing linelength like this"
We are testing linelength like this" "Linelength" "-l 15"

+ 2
- 24
tests/common View File

EXPECTED=$2 EXPECTED=$2
TEST_TEXT=$3 TEST_TEXT=$3
MESSAGE=$4 MESSAGE=$4
OPTIONS=$5


if [ "$MESSAGE" = "" ] ; then if [ "$MESSAGE" = "" ] ; then
MESSAGE=$TEST_TEXT MESSAGE=$TEST_TEXT


echo "testing ${TEST_LANG} $MESSAGE" echo "testing ${TEST_LANG} $MESSAGE"
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
src/espeak-ng -xq ${OPTIONS} -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
echo "${EXPECTED}" > expected.txt echo "${EXPECTED}" > expected.txt
if [ "$MESSAGE" = "broken" ] ; then if [ "$MESSAGE" = "broken" ] ; then
diff expected.txt actual.txt || (echo "... ignoring error (broken)" && true) diff expected.txt actual.txt || (echo "... ignoring error (broken)" && true)
fi fi
} }


test_commandlineoptions() {
TEST_LANG=$1
MESSAGE=$2
OPTIONS=$3
EXPECTED=$4
TEST_TEXT=$5
TEST_BROKEN=${6:-false}

if [ "x$MESSAGE" = x- ] ; then
echo "testing ${TEST_LANG}"
else
echo "testing ${TEST_LANG} ($MESSAGE)"
fi
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng ${OPTIONS} -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
echo "${EXPECTED}" > expected.txt
if [ x$TEST_BROKEN = xbroken ] ; then
diff expected.txt actual.txt || (echo "... ignoring error (broken)" && true)
else
diff expected.txt actual.txt || exit 1
fi
}


Loading…
Cancel
Save