From 75ea4b0bdf158bfbbe982241942afaf5367cf80d Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Wed, 10 Mar 2021 17:40:35 +0200 Subject: [PATCH] Tests: add tests for voice variants --- .gitignore | 1 + Makefile.am | 1 + tests/variants.test | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100755 tests/variants.test diff --git a/.gitignore b/.gitignore index 6d4383e4..c7bbd134 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,7 @@ tests/*.check !tests/language-replace.test !tests/ssml.test !tests/translate.test +!tests/variants.test !tests/non-executable-files-with-executable-bit.test !tests/bom.test !tests/klatt.test diff --git a/Makefile.am b/Makefile.am index 357a773e..3db91104 100644 --- a/Makefile.am +++ b/Makefile.am @@ -271,6 +271,7 @@ check: tests/encoding.check \ tests/non-executable-files-with-executable-bit.check \ tests/klatt.check \ tests/mbrola.check \ + tests/variants.check \ tests/bom.check \ tests/cmd_options.check diff --git a/tests/variants.test b/tests/variants.test new file mode 100755 index 00000000..ee9b2b1e --- /dev/null +++ b/tests/variants.test @@ -0,0 +1,40 @@ +#!/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_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" +# 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"