Files
espeak-ng/tests/klatt.test
T

49 lines
1.6 KiB
Bash
Executable File

#!/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 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"
test_voice en+klatt4 377767780368115863cde5cc11c0203cfdd48476 "The quick brown fox jumps over the lazy dog"
test_voice en+klatt5 62f7afeb70d83b9a934b3be71c8ab89bd562079d "The quick brown fox jumps over the lazy dog"