| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 | 
							- #!/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 2>/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
 - }
 - 
 - # Check processed text by phonetic representation of the output
 - test_phon() {
 -     TEST_LANG=$1
 -     EXPECTED=$2
 -     TEST_TEXT=$3
 -     MESSAGE=$4
 -     OPTIONS=$5
 - 
 -     if [ "$MESSAGE" = "" ] ; then
 -         MESSAGE=$TEST_TEXT
 -     fi
 - 
 -     echo "testing ${TEST_LANG} $MESSAGE"
 -     ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
 -         src/espeak-ng -xq ${OPTIONS} -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
 -     echo "${EXPECTED}" > expected.txt
 -     if [ "$MESSAGE" = "Ignore" ] ; then
 -         diff expected.txt actual.txt || (echo "... ignoring error" && true)
 -     else
 -         diff expected.txt actual.txt || exit 1
 -     fi
 - }
 - 
 - # Check generated wav file from processed text
 - test_wav () {
 -         VOICE=$1
 -         EXPECTED=$2
 -         TEST_TEXT=$3
 -         MESSAGE=$4
 - 
 -         echo "testing ${VOICE}${MESSAGE}"
 -         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
 -         if [ "$MESSAGE" = "Ignore" ] ; then
 -             diff expected.txt actual.txt || (echo "... ignoring error" && true)
 -         else
 -             diff expected.txt actual.txt || exit 1
 -         fi
 - }
 - 
 - # Check generated wav file from list of phonemes
 - test_phwav() {
 - 	TEST_LANG=$1
 - 	EXPECTED=$2
 - 	TEST_TEXT=$3
 -         test_wav $TEST_LANG $EXPECTED "[[$TEST_TEXT]]"
 - }
 - 
 - test_replace() {
 -     TEST_LANG=$1
 -     TEST_TEXT=$2
 -     MESSAGE=$3
 - 
 -     if [ "$MESSAGE" = "" ] ; then
 -         MESSAGE=$TEST_TEXT
 -     fi
 - 
 -     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 [ "$MESSAGE" = "Ignore" ] ; then
 -         diff expected.txt actual.txt || (echo "... ignoring error" && true)
 -     else
 -         diff expected.txt actual.txt || exit 1
 -     fi
 - }
 
 
  |