commit 4ece56c6bccbeecd2b21d782abd29df73a91cb1f
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Mar 13 15:16:52 2022 +0100

    clibrary2: avoid iterating over each and every voice
    
    And instead introduce clibrary3 that does it.

---
 src/tests/Makefile.am |    6 +++++-
 src/tests/clibrary2.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -48,7 +48,7 @@ $(TESTSUITE): package.m4 testsuite.at $(
 	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
 	mv $@.tmp $@
 
-check_PROGRAMS = long_message clibrary clibrary2 run_test connection_recovery \
+check_PROGRAMS = long_message clibrary clibrary2 clibrary3 run_test connection_recovery \
                spd_cancel_long_message spd_set_notifications_all
 
 long_message_SOURCES = long_message.c
@@ -60,6 +60,10 @@ clibrary_LDADD = $(c_api)/libspeechd.la
 clibrary2_SOURCES = clibrary2.c
 clibrary2_LDADD = $(c_api)/libspeechd.la $(EXTRA_SOCKET_LIBS)
 
+clibrary3_SOURCES = clibrary2.c
+clibrary3_LDADD = $(c_api)/libspeechd.la $(EXTRA_SOCKET_LIBS)
+clibrary3_CPPFLAGS = $(AM_CPPFLAGS) -DTHOROUGH
+
 connection_recovery_SOURCES = connection-recovery.c
 connection_recovery_LDADD = $(c_api)/libspeechd.la $(EXTRA_SOCKET_LIBS)
 
--- a/src/tests/clibrary2.c
+++ b/src/tests/clibrary2.c
@@ -42,6 +42,19 @@ int main()
 	int value;
 	SPDVoiceType voice_type = SPD_CHILD_MALE;
 	SPDVoice **synth_voices;
+#ifndef THOROUGH
+	SPDVoiceType voice_types[] = {
+		SPD_MALE1,
+		SPD_MALE2,
+		SPD_MALE3,
+		SPD_FEMALE1,
+		SPD_FEMALE2,
+		SPD_FEMALE3,
+		SPD_CHILD_MALE,
+		SPD_CHILD_FEMALE,
+		SPD_UNSPECIFIED
+	};
+#endif
 
 	printf("Start of the test.\n");
 
@@ -120,6 +133,7 @@ int main()
 			printf("spd_set_output_module failed");
 			exit(1);
 		}
+#ifdef THOROUGH
 		printf("\nListing voices for %s\n", modules[j]);
 		synth_voices = spd_list_synthesis_voices(conn);
 		if (synth_voices == NULL) {
@@ -140,6 +154,20 @@ int main()
 				printf("spd_set_synthesis_voice failed");
 				exit(1);
 			}
+#else
+		printf("\nIterating over voice types for %s\n", modules[j]);
+		for (i = 0;; i++) {
+			if (voice_types[i] == SPD_UNSPECIFIED)
+				break;
+			printf("     symbolic voice: %d\n",
+			       voice_types[i]);
+			ret =
+			    spd_set_voice_type(conn, voice_types[i]);
+			if (ret == -1) {
+				printf("spd_set_voice_type failed\n");
+				exit(1);
+			}
+#endif
 
 			ret = spd_say(conn, SPD_TEXT, "test");
 			if (ret == -1) {
