From ec552d2566c57982921fb6a19037cbcbdd116fc7 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Mon, 5 Apr 2021 23:19:39 +0300 Subject: [PATCH] Move common functions into common script --- tests/cmd_options.test | 25 +---- tests/common | 160 +++++++++++++++++++++++++++ tests/dictionary.test | 24 +--- tests/klatt.test | 46 +------- tests/language-numbers-cardinal.test | 20 +--- tests/language-numbers-ordinal.test | 20 +--- tests/language-phonemes.test | 37 +------ tests/language-pronunciation.test | 24 +--- tests/language-replace.test | 17 +-- tests/mbrola.test | 32 +----- tests/ssml.test | 24 +--- tests/translate.test | 78 ++++++------- tests/variants.test | 45 ++------ tests/voices.test | 26 +---- 14 files changed, 236 insertions(+), 342 deletions(-) create mode 100755 tests/common diff --git a/tests/cmd_options.test b/tests/cmd_options.test index 869a96ca..cd01bddf 100755 --- a/tests/cmd_options.test +++ b/tests/cmd_options.test @@ -1,27 +1,6 @@ #!/bin/sh - -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 -} +# include common script +. "`dirname $0`/common" ##### Script coverage diff --git a/tests/common b/tests/common new file mode 100755 index 00000000..1e15dfec --- /dev/null +++ b/tests/common @@ -0,0 +1,160 @@ +#!/bin/sh +# Test a command for presence and ability to output the sha1 hash of a file +is_hash() { + echo -n "checking for SHA1 hashing command ... " + if check_hash sha1sum; then + sha1sum=sha1sum + elif check_hash sha1; then + sha1sum=sha1 + elif check_hash shasum; then + sha1sum=shasum + else + echo "no" + exit 1 + fi +} +check_hash() { + which $1 && + $1 /dev/null | + awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' + # Test some common commands to find the correct one for the system being tested on. +} + +# test if Klatt synthesizer is installed +is_klatt() { + echo -n "checking if klatt is installed ... " + if [ "`which klatt`" != "" ]; then + echo "yes" + else + echo "no" + exit + fi +} + +# test if MBROLA synthesizer is installed +is_mbrola() { + echo -n "checking if MBROLA is installed ... " + if [ "`which mbrola`" != "" ]; then + echo "yes" + else + echo "no" + exit + fi +} + + +test_phonemes() { + TEST_LANG=$1 + MESSAGE=$2 + EXPECTED=$3 + TEST_TEXT=$4 + TEST_BROKEN=${5:-false} + + echo "testing ${TEST_LANG} ... $MESSAGE" + ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ + src/espeak-ng -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 +} + +test_phonemes1() { + TEST_LANG=$1 + EXPECTED=$2 + TEST_TEXT=$3 + + echo "testing ${TEST_LANG} \"${TEST_TEXT}\"" + ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ + src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt + echo "${EXPECTED}" > expected.txt + diff expected.txt actual.txt || exit 1 +} + +test_voice () { + VOICE=$1 + EXPECTED=$2 + TEST_TEXT=$3 + echo "testing ${VOICE} ... " + ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ + src/espeak-ng --stdout -v ${VOICE} "${TEST_TEXT}" | \ + $sha1sum | awk '{ print $1 }' > actual.txt + echo "${EXPECTED}" > expected.txt + diff expected.txt actual.txt || exit 1 +} + +test_lang() { + TEST_LANG=$1 + EXPECTED=$2 + TEST_TEXT=$3 + + echo "testing ${TEST_LANG}" + ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ + src/espeak-ng --stdout -v ${TEST_LANG} "[[${TEST_TEXT}]]" | \ + $sha1sum | awk '{ print $1 }' > actual.txt + echo "${EXPECTED}" > expected.txt + diff expected.txt actual.txt || exit 1 +} +c +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 +} + +test_replace() { + TEST_LANG=$1 + TEST_TEXT=$2 + TEST_BROKEN=${3:-false} + + echo "testing ${TEST_LANG}" + ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ + src/espeak-ng -Xq -v ${TEST_LANG} "${TEST_TEXT}" | grep -E "(Translate|Found:) " | sed -e 's/ \[.*][ ]*$//g' > actual.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 +} + +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 +} + diff --git a/tests/dictionary.test b/tests/dictionary.test index 7b30aa3c..f2f3402b 100755 --- a/tests/dictionary.test +++ b/tests/dictionary.test @@ -1,26 +1,6 @@ #!/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 -} +# include common script +. "`dirname $0`/common" ##### Dictionary flags # missing tests: only, only, stem, alt1..alt7, dot, hasdot, text, verbsf, accent_before, sentence, native diff --git a/tests/klatt.test b/tests/klatt.test index 3ee26ea8..e0a1c412 100755 --- a/tests/klatt.test +++ b/tests/klatt.test @@ -1,44 +1,10 @@ #!/bin/sh -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} - -test_voice () { - VOICE=$1 - EXPECTED=$2 - TEST_TEXT=$3 - echo "testing ${VOICE} ... " - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng --stdout -v ${VOICE} "${TEST_TEXT}" | \ - $sha1sum | awk '{ print $1 }' > actual.txt - echo "${EXPECTED}" > expected.txt - diff expected.txt actual.txt || exit 1 -} - -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi - -echo -n "checking if klatt is installed ... " -if [ "`which klatt`" != "" ]; then - echo "yes" -else - echo "no" - exit -fi - +# include common script +. "`dirname $0`/common" +# and run needed checks before +is_hash +is_klatt +# call actual test functions test_voice en+klatt 2d910bd0bf0735e479166302ad68ca245360b6f4 "The quick brown fox jumps over the lazy dog" test_voice en+klatt2 d986302f525b455222f7cb77d70425ad9e524207 "The quick brown fox jumps over the lazy dog" test_voice en+klatt3 71487b8cd764bbbffeee4545c9e742540d381fec "The quick brown fox jumps over the lazy dog" diff --git a/tests/language-numbers-cardinal.test b/tests/language-numbers-cardinal.test index f92ae365..6562cc6d 100755 --- a/tests/language-numbers-cardinal.test +++ b/tests/language-numbers-cardinal.test @@ -1,22 +1,6 @@ #!/bin/sh - -test_phonemes() { - TEST_LANG=$1 - MESSAGE=$2 - EXPECTED=$3 - TEST_TEXT=$4 - TEST_BROKEN=${5:-false} - - echo "testing ${TEST_LANG} ... $MESSAGE" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng -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 -} +# include common script +. "`dirname $0`/common" # European Style (hundred, thousand, -illion/-illiard) diff --git a/tests/language-numbers-ordinal.test b/tests/language-numbers-ordinal.test index 69b73a27..d83f6516 100755 --- a/tests/language-numbers-ordinal.test +++ b/tests/language-numbers-ordinal.test @@ -1,22 +1,6 @@ #!/bin/sh - -test_phonemes() { - TEST_LANG=$1 - MESSAGE=$2 - EXPECTED=$3 - TEST_TEXT=$4 - TEST_BROKEN=${5:-false} - - echo "testing ${TEST_LANG} ... $MESSAGE" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng -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 -} +# include common script +. "`dirname $0`/common" # European Style (hundred, thousand, -illion/-illiard) diff --git a/tests/language-phonemes.test b/tests/language-phonemes.test index 1468c89e..c49e0ada 100755 --- a/tests/language-phonemes.test +++ b/tests/language-phonemes.test @@ -1,37 +1,8 @@ #!/bin/sh - -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} - -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi - -test_lang() { - TEST_LANG=$1 - EXPECTED=$2 - TEST_TEXT=$3 - - echo "testing ${TEST_LANG}" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng --stdout -v ${TEST_LANG} "[[${TEST_TEXT}]]" | \ - $sha1sum | awk '{ print $1 }' > actual.txt - echo "${EXPECTED}" > expected.txt - diff expected.txt actual.txt || exit 1 -} +# include common script +. "`dirname $0`/common" +# and run needed checks before +is_hash test_lang af c71ab424d045d9fa82d2a23b9be4542aee3ed15e "ma na Na pa ta ka tSa ba da ga dZa fa sa x2a Sa va za Za ca la ja ra r/a _:_ m@ ma mE mI mO mW mu m& m&: m@L mA: me@ mi mo@ my miu m@U maI mAI meI mOI moI muI mYy mY@ maU me: mO: m3: mA~ me~ mo~" test_lang am 4fcdb9bb68b72c06e4cadf91b2c1e244ea14ac21 "ma na Na pa ta ka ?a ba da ga p\`a t\`a k\`a tSa dZa tS\`a Ba sa za Sa Za xa ha la ja wa ra _:_ mi me my ma m@ mo mu" diff --git a/tests/language-pronunciation.test b/tests/language-pronunciation.test index 36c16b1f..16965a6e 100755 --- a/tests/language-pronunciation.test +++ b/tests/language-pronunciation.test @@ -1,26 +1,6 @@ #!/bin/sh - -test_phonemes() { - 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 -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 -} +# include common script +. "`dirname $0`/common" ##### Script coverage diff --git a/tests/language-replace.test b/tests/language-replace.test index 53bba685..e7e87009 100755 --- a/tests/language-replace.test +++ b/tests/language-replace.test @@ -1,19 +1,6 @@ #!/bin/sh - -test_replace() { - TEST_LANG=$1 - TEST_TEXT=$2 - TEST_BROKEN=${3:-false} - - echo "testing ${TEST_LANG}" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng -Xq -v ${TEST_LANG} "${TEST_TEXT}" | grep -E "(Translate|Found:) " | sed -e 's/ \[.*][ ]*$//g' > actual.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 -} +# include common script +. "`dirname $0`/common" ##### bs: Bosnian diff --git a/tests/mbrola.test b/tests/mbrola.test index 01c655a8..2c9b34c3 100755 --- a/tests/mbrola.test +++ b/tests/mbrola.test @@ -1,10 +1,9 @@ #!/bin/sh -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} +# include common script +. "`dirname $0`/common" +# and run needed checks before +is_hash +is_mbrola check_voice_folder() { voice_file=${1#mb-} # remove mb- prefix @@ -37,27 +36,6 @@ test_voice () { fi } -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi - - -echo -n "checking if MBROLA is installed ... " -if [ "`which mbrola`" != "" ]; then - echo "yes" -else - echo "no" - exit -fi test_voice mb-fr4 31fae066f45d4a9dc56289344f28dd00bce77875 "Bonjour" test_voice mb-fr4+announcer f62c9cad15df194ac7cedfcfb36b6d9ccc70a634 "Bonjour" # mbrola + variant diff --git a/tests/ssml.test b/tests/ssml.test index 5da7213d..b6ee75d8 100755 --- a/tests/ssml.test +++ b/tests/ssml.test @@ -1,24 +1,8 @@ #!/bin/sh - -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} - -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi +# include common script +. "`dirname $0`/common" +# and run needed checks before +is_hash test_ssml_audio() { TEST_NAME=$1 diff --git a/tests/translate.test b/tests/translate.test index dec9247c..9851d1b9 100755 --- a/tests/translate.test +++ b/tests/translate.test @@ -1,92 +1,82 @@ #!/bin/sh - -test_phonemes() { - TEST_LANG=$1 - EXPECTED=$2 - TEST_TEXT=$3 - - echo "testing ${TEST_LANG} \"${TEST_TEXT}\"" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt - echo "${EXPECTED}" > expected.txt - diff expected.txt actual.txt || exit 1 -} +# include common script +. "`dirname $0`/common" # word lookup -test_phonemes en "h@l'oU" "hello" +test_phonemes1 en "h@l'oU" "hello" # correct word stress -test_phonemes en "s'VmTIN Imp'o@t@nt" "something important" +test_phonemes1 en "s'VmTIN Imp'o@t@nt" "something important" # suffix rules -test_phonemes lv \ +test_phonemes1 lv \ "nev'ie:na nuo\`_ 'eiRo:pas v'alsti:m nek,ad nav p'a:Rga:jusi nuo\`_ 'univERsa:la:s_:_: nuo\` v'ispa:Re:jiem n'uoduok_|l^iem f'inanse:tas_:_: s'iste:mas uz 'obliga:ta:s 'apdRuoSina:Sanas s'iste:mu b'eigas" \ "Neviena no Eiropas valstīm nekad nav pārgājusi no universālās (no vispārējiem nodokļiem finansētas) sistēmas uz obligātās apdrošināšanas sistēmu Beigas." # A list entry that uses '$text' to map to another list entry crashes 1.49.2 multi-word support: -test_phonemes en "d'eIbju:tI2d" "débuted" -test_phonemes en-US "d'eIbju:t#I#d" "débuted" +test_phonemes1 en "d'eIbju:tI2d" "débuted" +test_phonemes1 en-US "d'eIbju:t#I#d" "débuted" # s at the end of abbreviations # https://github.com/espeak-ng/espeak-ng/issues/706 -test_phonemes en ",aIb,i:;'Em m'It 'Ib@mz m'Its ,aIb,i:;'Em ,Em,aIt'i:; ,eIp,i:;'eItS s,i:;,i:;'Es ,aIt,i:;'Eks ,aIb,i:;'Emz ,Em,aIt'i:z ,eIp,i:;'eItSIz s,i:;,i:;'EsIz ,aIt,i:;'EksIz" "ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs" -test_phonemes lv "'ibm m'it 'ibm-s m'its 'ibm m'it 'aph ts'Es 'it_ks 'ibm-s m'its 'aphs ts'Ess 'it_kss 'a>_:,ess_! ,a:_:,ess_!v'e:_:_:_: s'i:a:_ 'u>_:t,e:_:t,e:_:" "ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs AS ASV SIA utt" -test_phonemes ru "'Ibm (en),aIb,i:;'Em m'It 'Ib@mz m'Its ,aIb,i:;'Em ,Em,aIt'i:; ,eIp,i:;'eItS s,i:;,i:;'Es ,aIt,i:;'Eks 'Ib@mz m'Its 'afz s'EI2zI2z 'ItEksz(ru) SS'A" "ИБМ ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs США" +test_phonemes1 en ",aIb,i:;'Em m'It 'Ib@mz m'Its ,aIb,i:;'Em ,Em,aIt'i:; ,eIp,i:;'eItS s,i:;,i:;'Es ,aIt,i:;'Eks ,aIb,i:;'Emz ,Em,aIt'i:z ,eIp,i:;'eItSIz s,i:;,i:;'EsIz ,aIt,i:;'EksIz" "ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs" +test_phonemes1 lv "'ibm m'it 'ibm-s m'its 'ibm m'it 'aph ts'Es 'it_ks 'ibm-s m'its 'aphs ts'Ess 'it_kss 'a>_:,ess_! ,a:_:,ess_!v'e:_:_:_: s'i:a:_ 'u>_:t,e:_:t,e:_:" "ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs AS ASV SIA utt" +test_phonemes1 ru "'Ibm (en),aIb,i:;'Em m'It 'Ib@mz m'Its ,aIb,i:;'Em ,Em,aIt'i:; ,eIp,i:;'eItS s,i:;,i:;'Es ,aIt,i:;'Eks 'Ib@mz m'Its 'afz s'EI2zI2z 'ItEksz(ru) SS'A" "ИБМ ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs США" # bug: https://github.com/nvaccess/nvda/issues/7740 -test_phonemes ta "'il." "ள்" -test_phonemes my "kon'i" "7" -test_phonemes ka "s'ami Sv'idi" "3 7" +test_phonemes1 ta "'il." "ள்" +test_phonemes1 my "kon'i" "7" +test_phonemes1 ka "s'ami Sv'idi" "3 7" # bug: https://github.com/nvaccess/nvda/issues/7805 -test_phonemes hi "r'UcI" "रुचि" -test_phonemes hi "dUk'a:n" "दुकान" -test_phonemes hi "ka:n'u:n" "कानून" +test_phonemes1 hi "r'UcI" "रुचि" +test_phonemes1 hi "dUk'a:n" "दुकान" +test_phonemes1 hi "ka:n'u:n" "कानून" # bug: https://github.com/espeak-ng/espeak-ng/issues/824 -test_phonemes ru "(en)s'i:(ru) n'ojl t'otS;ka v'os;E2md;E2s;ats;'ejm m;,IlI;'onof_! p;,It;s'ot SE2z;d;d;Is;'jatd;'evI3t; t'ys;VtS;_! dv;'es;t;I p;Vd;d;Is;'jattR;'i p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I ojd;'in p@-rats'Ent dv;'es;t;I t'otS;ka t@-r;'ittsat;S'Es;t; t'ys;VtS;_! vOs;Ims'ot s;Imn'AttsVt; p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka dv;'e t'ys;VdZ; d;E2v;Itn'AttsVt; p@-rats'Ent dv;'es;t;I ojd;'in t'otS;ka n'ojl tR;'iv'os;E#m_!s;'ejm d;'evI3t;S'Es;t;_!tR;'i p@-rats'Ent dv'A (en)s'i:(ru) ojd;'in t'otS;ka n'ojl tR;'iv'os;E#m_!s;'ejm d;'evI3t;S'Es;t;_!tR;'i p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I ojd;'in p@-rats'Ent dv;'es;t;I t'otS;ka tS;It'yr;E2sta d;E2v;Itn'AttsVt; t'ys;VtS;_! S,E#s;t;s'ot t@-r;'ittsat;s;'ejm p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka n'ojldv'A_! tR;'is;'ejm_!p;'jat; p@-rats'Ent dv'AttsVt; (en)s'i:(ru) p@-rats'Ent dv;'es;t;I t'otS;ka t@-r;'ittsVt; t'ys;VtS;_! v'os;E2md;E2s;ats;'ejm p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka n'ojltS;It'yR;I_! p;'jat;Vjd;'in_!tS;It'yR;I p@-rats'Ent dv;'es;t;I t'otS;ka p;,It;s'ot v'os;E2md;E2s;atdv;'e t'ys;VtS;_! s;,Ims'ot t@-r;'ittsat;d;'evI3t; p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka dv;'es;t;I SE#stn'AttsVt; t'ys;VtS;_! dev;ats'ot s'o@-*Okdv'A p@-rats'Ent dv;'es;t;I t'otS;ka s;,Ims'ot p;Vd;d;Is;'jat t'ys;VtS;_! p;,It;s'ot d;E2v;In'ostOtR;'i p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka tS;It'yr;E2sta s;'emd;E2s;Vt t'ys;VtS;_! t@-r;'ista v'os;E2m p@-rats'Ent dv;'es;t;I t'otS;ka n'ojld;'evI3t;_! p;'jat;n'ojl_!dv'A p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka st'o s'o@-*Okdv;'e t'ys;VtS;_! p;,It;s'ot s;Imn'AttsVt; p@-rats'Ent +test_phonemes1 ru "(en)s'i:(ru) n'ojl t'otS;ka v'os;E2md;E2s;ats;'ejm m;,IlI;'onof_! p;,It;s'ot SE2z;d;d;Is;'jatd;'evI3t; t'ys;VtS;_! dv;'es;t;I p;Vd;d;Is;'jattR;'i p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I ojd;'in p@-rats'Ent dv;'es;t;I t'otS;ka t@-r;'ittsat;S'Es;t; t'ys;VtS;_! vOs;Ims'ot s;Imn'AttsVt; p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka dv;'e t'ys;VdZ; d;E2v;Itn'AttsVt; p@-rats'Ent dv;'es;t;I ojd;'in t'otS;ka n'ojl tR;'iv'os;E#m_!s;'ejm d;'evI3t;S'Es;t;_!tR;'i p@-rats'Ent dv'A (en)s'i:(ru) ojd;'in t'otS;ka n'ojl tR;'iv'os;E#m_!s;'ejm d;'evI3t;S'Es;t;_!tR;'i p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I ojd;'in p@-rats'Ent dv;'es;t;I t'otS;ka tS;It'yr;E2sta d;E2v;Itn'AttsVt; t'ys;VtS;_! S,E#s;t;s'ot t@-r;'ittsat;s;'ejm p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka n'ojldv'A_! tR;'is;'ejm_!p;'jat; p@-rats'Ent dv'AttsVt; (en)s'i:(ru) p@-rats'Ent dv;'es;t;I t'otS;ka t@-r;'ittsVt; t'ys;VtS;_! v'os;E2md;E2s;ats;'ejm p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka n'ojltS;It'yR;I_! p;'jat;Vjd;'in_!tS;It'yR;I p@-rats'Ent dv;'es;t;I t'otS;ka p;,It;s'ot v'os;E2md;E2s;atdv;'e t'ys;VtS;_! s;,Ims'ot t@-r;'ittsat;d;'evI3t; p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka dv;'es;t;I SE#stn'AttsVt; t'ys;VtS;_! dev;ats'ot s'o@-*Okdv'A p@-rats'Ent dv;'es;t;I t'otS;ka s;,Ims'ot p;Vd;d;Is;'jat t'ys;VtS;_! p;,It;s'ot d;E2v;In'ostOtR;'i p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka tS;It'yr;E2sta s;'emd;E2s;Vt t'ys;VtS;_! t@-r;'ista v'os;E2m p@-rats'Ent dv;'es;t;I t'otS;ka n'ojld;'evI3t;_! p;'jat;n'ojl_!dv'A p@-rats'Ent dv'A (en)s'i:(ru) n'ojl t'otS;ka st'o s'o@-*Okdv;'e t'ys;VtS;_! p;,It;s'ot s;Imn'AttsVt; p@-rats'Ent dv'A (en)s'i:(ru) v'os;E2m t'otS;ka vOs;Ims'ot dv'Attsat;d;'evI3t; t'ys;VtS;_! s;,Ims'ot SE2z;d;d;Is;'jatv'os;E2m p@-rats'Ent dv'AttsVt; (en)s'i:(ru) p@-rats'Ent dv;'es;t;I p@-rats'Ent dv'A (en)s'i:(ru) p;'jat; t'otS;ka S,E#s;t;s'ot SE2z;d;d;Is;'jatd;'evI3t; t'ys;VtS;_! s'o@-*Okojd;'in p@-rats'Ent dv'AttsVt; tS;It'yR;I t'otS;ka p;Vd;d;Is;'jatd;'evI3t; t'ys;VtS;_! S,E#s;t;s'ot d;E2v;In'ostOd;'evI3t; p@-rats'Ent dv'A (en)s'i:(ru) d;'es;It; t'otS;ka dv'A m;,IlI;'onof_! S,E#s;t;s'ot p;Vd;d;Is;'jatdv;'e t'ys;VtS;_! t@-r;'ista d;E2v;In'ostOojd;'in p@-rats'Ent dv'AttsVt; d;'es;It; t'otS;ka dv;'es;t;I SE2z;d;d;Is;'jatp;'jat; t'ys;VtS;_! dv;'es;t;I t@-r;'ittsat;v'os;E2m p@-rats'Ent dv'A (en)s'i:(ru) d;'es;It; t'otS;ka dv'A m;,IlI;'onof_! S,E#s;t;s'ot p;Vd;d;Is;'jatdv;'e t'ys;VtS;_! t@-r;'ista d;E2v;In'ostOojd;'in p@-rats'Ent dv'AttsVt; (en)z'Ed(ru) p@-rats'Ent dv'AttsVt; (en)'Em(ru) p@-rats'Ent dv;'e t'ys;VdZ; d;'es;It; t'otS;ka n'ojltR;'i_!s;'ejm v'os;E#mS'Es;t;_!p;'jat; p@-rats'Ent dv'A (en)s'i:(ru) d;E2v;Itn'AttsVt; t'otS;ka s;,Ims'ot d;E2v;In'ostOv'os;E2m t'ys;VtS;_! p;,It;s'ot t@-r;'ittsat;s;'ejm p@-rats'Ent dv'AttsVt; (en)v'i:(ru) p@-rats'Ent dv;'es;t;I ojd;'in t'otS;ka st'o s;'emd;E2s;VttS;It'yR;I t'ys;VtS;_! st'o v'os;E2md;E2s;atv'os;E2m p@-rats'Ent dv'AttsVt; (en)'eI(ru) p@-rats'Ent dv;'es;t;I ojd;'in t'otS;ka tS;It'yr;E2sta v'os;E2md;E2s;atv'os;E2m t'ys;VtS;_! p;,It;s'ot d;E2v;Itn'AttsVt; p@-rats'Ent dv'A (en)s'i:(ru) ojd;'in t'otS;ka tS;It'yr;E2sta v'os;E2md;E2s;atv'os;E2m t'ys;VtS;_! p;,It;s'ot d;E2v;Itn'AttsVt; p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I p@-rats'Ent dv;'es;t;I ojd;'in p@-rats'Ent dv;'es;t;I t'otS;ka vOs;Ims'ot p;Vd;d;Is;'jats;'ejm t'ys;VtS;" "C0.87569253%200%200%201%200.36817%2C-0.2019%201.0387963%2C1.0387963%200%200%201%200.419637%2C-0.02375%20c%200.30087%2C0.04514%200.582739%2C0.216942%200.750593%2C0.470308%200.09502%2C0.142517%200.153603%2C0.308788%200.18844%2C0.478226%200.03484%2C0.168646%200.0475%2C0.340459%200.05701%2C0.513064%200.03167%2C0.601741%200.03167%2C1.205067%200.01426%2C1.808392%20-0.01426%2C0.526524%20-0.04355%2C1.0673%20-0.253366%2C1.549486%20-0.271575%2C0.619159%20-0.817101%2C1.08155%20-1.405383%2C1.414092%20a%205.5835296%2C5.5835296%200%200%201%20-1.257323%2C0.512272%20c%200.38163%2C1.219319%200.580363%2C2.56532%200.580363%2C3.93349%20a%2013.935071%2C13.935071%200%200%201%20-0.106901%2C1.682498%2010.264446%2C10.264446%200%200%200%205.054631%2C-8.829768%20c%200%2C-5.669041%20-4.59699%2C-10.2652391%20-10.265238%2C-10.2652391%20z%20M%2010.037865%2C19.798537%20v%201.174188%20a%201.488519%2C1.488519%200%200%201%200.857482%2C0.286619%201.3760882%2C1.3760882%200%200%201%200.440222%2C0.538402%20c%200.0966%2C0.213775%200.131432%2C0.456056%200.09184%2C0.687252%20a%201.1821057%2C1.1821057%200%200%201%20-0.262867%2C0.560568%201.3040376%2C1.3040376%200%200%201%20-0.502772%2C0.36263%201.3760882%2C1.3760882%200%200%201%20-0.623119%2C0.0966%20v%202.953287%20l%206.145683%2C-3.33175%20-6.145683%2C-3," # A deleted phoneme at the start of a word should preserve the sourceix property. -test_phonemes en-GB-x-gbcwmd "aI 'av" "I have" +test_phonemes1 en-GB-x-gbcwmd "aI 'av" "I have" # A deleted phonSWITCH should preserve the sourceix property of the deleted phoneme. -test_phonemes hyw "'a g@rn'am" "A Կրնամ" +test_phonemes1 hyw "'a g@rn'am" "A Կրնամ" -test_phonemes en "'eI +test_phonemes1 en "'eI b'i: s'i: d'i: 'i: 'Ef" "A. B C, D. E: F." # Handling of english acronym + genitive without breaking simple quote -test_phonemes en "hi: s'Ed +test_phonemes1 en "hi: s'Ed aI w0z b'O@n InD@ j,u:,Es'eI z_:_: and l'Eft" "He said : I was born in the u.s.a.'s and left." -test_phonemes en "hi: s'Ed +test_phonemes1 en "hi: s'Ed h@l'oU aIa#m b'ak and l'Eft" "He said : 'Hello, I am back.' and left." # Hawaiian okina to apostrophe -test_phonemes en "h@w'aIi:" "Hawaiʻi" +test_phonemes1 en "h@w'aIi:" "Hawaiʻi" #----- Emoji [http://www.unicode.org/reports/tr51/tr51-12.html] ----- # ED-3 - emoji_character -test_phonemes en "'e@ri:z" "♈" -test_phonemes my "pru3'a2nke3DN_|_| mj@@lu3'a2mj@2tsnh,a2N_|_| nm_|n'e3DN_|_| mj@@nh,ats" "😙" -test_phonemes ka "k'ots#nis g'amomx,atveli s'axe m'omQim,are t#v'alebit#" "😙" -test_phonemes ka "'imedg,ats#ru,ebuli m'agram Sv'ebis g'amomx,atveli s'axe" "😥" +test_phonemes1 en "'e@ri:z" "♈" +test_phonemes1 my "pru3'a2nke3DN_|_| mj@@lu3'a2mj@2tsnh,a2N_|_| nm_|n'e3DN_|_| mj@@nh,ats" "😙" +test_phonemes1 ka "k'ots#nis g'amomx,atveli s'axe m'omQim,are t#v'alebit#" "😙" +test_phonemes1 ka "'imedg,ats#ru,ebuli m'agram Sv'ebis g'amomx,atveli s'axe" "😥" # TODO: Fix adjacent emoji without whitespace so the pronunciation is separated by a space. -test_phonemes en "'e@ri:zr'eInboU" "♈🌈" -test_phonemes en "'e@ri:z r'eInboU" "♈ 🌈" +test_phonemes1 en "'e@ri:zr'eInboU" "♈🌈" +test_phonemes1 en "'e@ri:z r'eInboU" "♈ 🌈" # multi-word emoji -test_phonemes en "Ekskla#m'eIS@n kw'EstS@n m'A@k" "⁉" -test_phonemes en "Ekskla#m'eIS@n kw'EstS@n m'A@k r'eInboU" "⁉ 🌈" -test_phonemes en "r'oUlIN 0nD@ fl'o@ l'aafIN" "🤣" # skip words +test_phonemes1 en "Ekskla#m'eIS@n kw'EstS@n m'A@k" "⁉" +test_phonemes1 en "Ekskla#m'eIS@n kw'EstS@n m'A@k r'eInboU" "⁉ 🌈" +test_phonemes1 en "r'oUlIN 0nD@ fl'o@ l'aafIN" "🤣" # skip words # bug: https://github.com/espeak-ng/espeak-ng/issues/471 -test_phonemes sk "sm'eju:tsa s'a tv'a:R" "☺" -test_phonemes sk "bl'ax sm'eju:tsa s'a tv'a:R" "blah ☺" +test_phonemes1 sk "sm'eju:tsa s'a tv'a:R" "☺" +test_phonemes1 sk "bl'ax sm'eju:tsa s'a tv'a:R" "blah ☺" diff --git a/tests/variants.test b/tests/variants.test index ee9b2b1e..d9bf78dd 100755 --- a/tests/variants.test +++ b/tests/variants.test @@ -1,40 +1,11 @@ #!/bin/sh +# include common script +. "`dirname $0`/common" +# and run needed checks before +is_hash -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} - -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi - -test_variants() { - TEST_LANG=$1 - EXPECTED=$2 - TEST_TEXT=$3 - - echo "testing ${TEST_LANG}" - ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng --stdout -v ${TEST_LANG} "${TEST_TEXT}" | \ - $sha1sum | awk '{ print $1 }' > actual.txt - echo "${EXPECTED}" > expected.txt - diff expected.txt actual.txt || exit 1 -} - -test_variants "en" 029983e9084e04384af8a0816fb667e5c5e06389 "Testing variants" +test_voice "en" 029983e9084e04384af8a0816fb667e5c5e06389 "Testing variants" # variant doesn't exist, should be equal to en: -test_variants "en+nonexisting" 029983e9084e04384af8a0816fb667e5c5e06389 "Testing variants" -test_variants "en+f1" dba359ac75ec33cc9cd4bd2af5031a3dbd84427c "Testing variants" -test_variants "en+anikaRobot" d56012d8f4cfb4c36fdad31ad9ad7abda40ef474 "Testing variants" +test_voice "en+nonexisting" 029983e9084e04384af8a0816fb667e5c5e06389 "Testing variants" +test_voice "en+f1" dba359ac75ec33cc9cd4bd2af5031a3dbd84427c "Testing variants" +test_voice "en+anikaRobot" d56012d8f4cfb4c36fdad31ad9ad7abda40ef474 "Testing variants" diff --git a/tests/voices.test b/tests/voices.test index e7b3afa1..b19437d9 100755 --- a/tests/voices.test +++ b/tests/voices.test @@ -1,27 +1,7 @@ #!/bin/sh - -test_voices() { - 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 -} +# include common script +. "`dirname $0`/common" ##### Voice options -test_voices ka "lowercaseSentence" "s'asi,amovn,oa t#k#v'eni g'ats#noba +test_dict ka "lowercaseSentence" "s'asi,amovn,oa t#k#v'eni g'ats#noba r'ogor brdz'andebit#" "სასიამოვნოა თქვენი გაცნობა. როგორ ბრძანდებით" #872