diff --git a/Makefile.am b/Makefile.am index abe189a2..bf6c34a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -232,9 +232,16 @@ tests_tokenizer_test_SOURCES = \ src/libespeak-ng/tokenizer.c \ tests/tokenizer.c -check: tests/encoding.test tests/tokenizer.test tests/languages.test +noinst_bin_PROGRAMS += tests/voices.test + +tests_voices_test_LDADD = src/libespeak-ng.la +tests_voices_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS} +tests_voices_test_SOURCES = tests/voices.c + +check: tests/encoding.test tests/tokenizer.test tests/voices.test tests/languages.test tests/encoding.test tests/tokenizer.test + ESPEAK_DATA_PATH=$(PWD) tests/voices.test tests/languages.test ##### phoneme data: diff --git a/tests/voices.c b/tests/voices.c new file mode 100644 index 00000000..a319ad4c --- /dev/null +++ b/tests/voices.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2017 Reece H. Dunn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write see: + * . + */ + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +void +test_selection_by_name() +{ + printf("testing selection of voice by name\n"); + + assert(espeak_SetVoiceByName("de") == EE_OK); + + assert(espeak_SetVoiceByName("und") == EE_NOT_FOUND); + + assert(espeak_ng_SetVoiceByName("de") == ENS_OK); + + assert(espeak_ng_SetVoiceByName("und") == ENS_VOICE_NOT_FOUND); +} + +int +main(int argc, char **argv) +{ + assert(espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, NULL, espeakINITIALIZE_DONT_EXIT) == 22050); + + test_selection_by_name(); + + assert(espeak_Terminate() == EE_OK); + + printf("done\n"); + + return EXIT_SUCCESS; +}