Browse Source

Tests: new test collection for dictionary files.

The file is intended for everything mentioned in docs/dictionary.md.
master
Juho Hiltunen 4 years ago
parent
commit
a36f5573d2
3 changed files with 59 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 1
    0
      Makefile.am
  3. 57
    0
      tests/dictionary.test

+ 1
- 0
.gitignore View File

@@ -113,6 +113,7 @@ tests/*.check
!tests/bom.test
!tests/klatt.test
!tests/mbrola.test
!tests/dictionary.test

espeak-ng.pc


+ 1
- 0
Makefile.am View File

@@ -262,6 +262,7 @@ check: tests/encoding.check \
tests/ssml.check \
tests/ssml-fuzzer.check \
tests/api.check \
tests/dictionary.check \
tests/language-phonemes.check \
tests/language-replace.check \
tests/language-pronunciation.check \

+ 57
- 0
tests/dictionary.test View File

@@ -0,0 +1,57 @@
#!/bin/sh

test_dict() {
TEST_LANG=$1
MESSAGE=$2
EXPECTED=$3
TEST_TEXT=$4
TEST_BROKEN=${5:-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
}

##### Dictionary flags
# missing tests: only, only, stem, alt1..alt7, dot, hasdot, text, verbsf, accent_before, sentence, native

test_dict en "\$1 - \$7" "'adbl0k adv'3:s ,abs@nt'i: g,astroUInt'EstIn@L" "adblock adverse absentee gastrointestinal"
test_dict en "\$u and \$u+" "fO@ ju:_:_: and Di:; aI k@mp'e@ D'i:" "for you and thee I compare thee"
test_dict en "\$u1 and \$u1+" "aI w,oUnta#v_:_: b,Vt ju: S,Ud@v_:_: and DeI S'Udhav" "I won't have but you should have and they should have"
test_dict en "\$u2 and \$u2+" "@p,0n DIs aIvh,ad w0t aIvh'ad" "Upon this I've had what I've had"
test_dict ro "\$u3 and \$u3+" ",anum,ite d,umneat,a d'umneat,a" "anumite dumneata dumneata"
test_dict en "\$pause" "ju: n'oU It_:_: bIk'0z DIs ha#z_:_: s'Ins b,i:n" "you know it because this has since been"
test_dict en "\$brk" "_!wID,In_! wID,In_! wID,In wID'In" "within within within within"
test_dict de "\$strend" "maR'i:A: l'i:st t'o:mA:s de:n ts'aIt_|,Ungzart,i:k@l f'Or" "Maria liest Thomas den Zeitungsartikel vor"
test_dict de "\$strend2" "j'Etst _|,EtvA:" "jetzt etwa"
test_dict hu "\$unstressend" "m'EgfiJEle:Se:hEz" "megfigyeléséhez"
test_dict en "\$abbrev" ",Em,oUt,i:d'i:; 0vDI2; ,aI;,A@s'i:; ,Em,Em'oU,A@p,i:dZ'i:" "motd of the irc mmorpg"
test_dict fi "\$double" "t'ule t:'&nne_:_: ja s'yYr r'uoka:" "tule tänne ja syö ruokaa"
test_dict en "\$max3" "'ast@r,Iska#st@r,Iska#st@r,Isk" "*****"
test_dict sk "\$combine" "n'aobed b'esjedla" "na obed bez jedla"
test_dict en "\$verb and \$verbf \(not $verbsf\)" "O:lt'3:n@t s'u:n 'O:lt3n,eIt_:_: and '0lt3n,eIts s'u:n 'O:lt3n,eIts" "alternate soon alternate and alternates soon alternates"
test_dict en "\$noun and \$nounf" "It Iz n,0t@ d'aIdZEst t@ daIdZ'Est" "it is not a digest to digest"
test_dict en "\$verbextend" "a# d'aIdZEst t@ n,0t 'adI2d 'Ekstr@ w'3:dz h'i@3 daIdZ'Est" "a digest to not added extra words here digest"
test_dict en "\$pastf and \$past" "r'i:d t@bi r'Ed" "read to be read"
test_dict en "\$capital" "D@ p'oUlIS p'0lIS" "The Polish polish"
test_dict en "\$allcaps" ",aIt'i: h'az j,u:'Es v,i:;'Es It ha#z ,Vs" "IT HAS US vs it has us"
test_dict af "\$accent" "d'e@lte@k@n_|'o@ k'api_|'o@ _|ak'yt_|'o@" "ö ô ó"
test_dict it "\$atstart" "fig'uRatI v,U'Esse figUR'atI" "figurati vs figurati"
test_dict it "\$atend" "s,Ents2a v,U'Esse s'Entsa" "senza vs senza"
test_dict en ".replace" "m'eIlstr0m m'eIlstr0m" "mælstrom maelstrom"
# rest of the numbers are tested in other test files
test_dict en "_dpt" "z'i@roU pOInt n'aIn n'aIn" "0.99"
test_dict ru "_dpt2" "ojd;'in _:'i_: n'ojl n'ojl_d;Is;'AtYx" "1,00"
test_dict en "_0and" "t'u:h'VndrI2d@n tw'Enti" "220"
test_dict af "_^_" "(fr)avinj'O~(en) b'0st@n(af) S'ina" "avignon boston china"
test_dict en "(multiple words)" "s'VtS _a#z" "such as"

Loading…
Cancel
Save