From 1c7c6debcca42d0455daf18da70ce4385454d89f Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Wed, 28 Feb 2018 07:10:32 +0000 Subject: [PATCH] tests: test af consonant and vowel audio generation --- .gitignore | 1 + Makefile.am | 1 + tests/phoneme-audio.test | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100755 tests/phoneme-audio.test diff --git a/.gitignore b/.gitignore index 36d797e3..145e4cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -99,6 +99,7 @@ src/speak-ng tests/*.test !tests/languages.test !tests/phoneme-output.test +!tests/phoneme-audio.test espeak-ng.pc diff --git a/Makefile.am b/Makefile.am index 92f207db..c2d5851b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -251,6 +251,7 @@ check: tests/encoding.check \ tests/readclause.check \ tests/api.check \ tests/phoneme-output.check \ + tests/phoneme-audio.check \ tests/languages.check ##### phoneme data: diff --git a/tests/phoneme-audio.test b/tests/phoneme-audio.test new file mode 100755 index 00000000..6a08d5a6 --- /dev/null +++ b/tests/phoneme-audio.test @@ -0,0 +1,35 @@ +#!/bin/sh + +# Test a command for presence and ability to output the sha1 hash of a file. +check_hashcmd() { + which $1 &>/dev/null && + $1 /dev/null | + awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' +} + +# Test some common commands to find the correct one for the system being tested on. +if check_hashcmd sha1sum; then + sha1sum=sha1sum +elif check_hashcmd sha1; then + sha1sum=sha1 +elif check_hashcmd shasum; then + sha1sum=shasum +else + echo "No hashing commands found." + 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 +} + +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~"