diff --git a/Makefile.am b/Makefile.am
index 900a9049..52df9575 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -245,6 +245,12 @@ tests_readclause_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS}
tests_readclause_test_LDADD = src/libespeak-ng-test.la
tests_readclause_test_SOURCES = tests/readclause.c
+noinst_bin_PROGRAMS += tests/api.test
+
+tests_api_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS}
+tests_api_test_LDADD = src/libespeak-ng-test.la
+tests_api_test_SOURCES = tests/api.c
+
%.check: %.test
@echo " TEST $<"
@ESPEAK_DATA_PATH=$(PWD) $< && echo " PASSED $<"
@@ -252,6 +258,7 @@ tests_readclause_test_SOURCES = tests/readclause.c
check: tests/encoding.check \
tests/tokenizer.check \
tests/readclause.check \
+ tests/api.check \
tests/languages.check
##### phoneme data:
diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c
index 9ac8f0c3..6e2c3b04 100644
--- a/src/libespeak-ng/speech.c
+++ b/src/libespeak-ng/speech.c
@@ -399,7 +399,7 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
count_samples = 0;
if (translator == NULL)
- espeak_SetVoiceByName("default");
+ espeak_SetVoiceByName("en");
if (p_decoder == NULL)
p_decoder = create_text_decoder();
diff --git a/tests/api.c b/tests/api.c
new file mode 100644
index 00000000..859e78e4
--- /dev/null
+++ b/tests/api.c
@@ -0,0 +1,86 @@
+/*
+ * 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
+
+#include "speech.h"
+#include "phoneme.h"
+#include "synthesize.h"
+#include "translate.h"
+
+void
+test_espeak_terminate_without_initialize()
+{
+ printf("testing espeak_Terminate without espeak_Initialize\n");
+
+ assert(event_list == NULL);
+
+ assert(espeak_Terminate() == EE_OK);
+ assert(event_list == NULL);
+}
+
+void
+test_espeak_initialize()
+{
+ printf("testing espeak_Initialize\n");
+
+ assert(event_list == NULL);
+
+ assert(espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0) == 22050);
+ assert(event_list != NULL);
+
+ assert(espeak_Terminate() == EE_OK);
+ assert(event_list == NULL);
+}
+
+void
+test_espeak_synth()
+{
+ printf("testing espeak_Synth\n");
+
+ assert(event_list == NULL);
+
+ assert(espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, 0, NULL, 0) == 22050);
+ assert(event_list != NULL);
+
+ const char *test = "One two three.";
+ assert(espeak_Synth(test, strlen(test)+1, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL) == EE_OK);
+ assert(espeak_Synchronize() == EE_OK);
+
+ assert(espeak_Terminate() == EE_OK);
+ assert(event_list == NULL);
+}
+
+int
+main(int argc, char **argv)
+{
+ test_espeak_terminate_without_initialize();
+ test_espeak_initialize();
+
+ test_espeak_synth();
+
+ return EXIT_SUCCESS;
+}