Browse Source

Add test for Klatt voices

master
Valdis Vitolins 4 years ago
parent
commit
02174e2f76
3 changed files with 49 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 1
    0
      Makefile.am
  3. 47
    0
      tests/klatt.test

+ 1
- 0
.gitignore View File

@@ -111,6 +111,7 @@ tests/*.check
!tests/translate.test
!tests/non-executable-files-with-executable-bit.test
!tests/bom.test
!tests/klatt.test
!tests/mbrola.test

espeak-ng.pc

+ 1
- 0
Makefile.am View File

@@ -257,6 +257,7 @@ check: tests/encoding.check \
tests/language-numbers-cardinal.check \
tests/language-numbers-ordinal.check \
tests/non-executable-files-with-executable-bit.check \
tests/klatt.check \
tests/mbrola.check \
tests/bom.check


+ 47
- 0
tests/klatt.test View File

@@ -0,0 +1,47 @@
#!/bin/sh
# Test a command for presence and ability to output the sha1 hash of a file.
check_hashcmd() {
which $1 &&
$1 </dev/null 2>/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

test_voice en+klatt 83be910e5e23ea8e3ac9df6f86253b9296491367 "The quick brown fox jumps over the lazy dog"
test_voice en+klatt2 e9f31d6f515ab6d83e3c39a15b595d0732a084f9 "The quick brown fox jumps over the lazy dog"
test_voice en+klatt3 8067add512b2541132c6cc831e03ab7361a691b8 "The quick brown fox jumps over the lazy dog"
test_voice en+klatt4 15e2d269495e382315284eedfd72f91ab821f0d1 "The quick brown fox jumps over the lazy dog"



Loading…
Cancel
Save