|
|
|
|
|
|
|
|
if (p_decoder == NULL) |
|
|
if (p_decoder == NULL) |
|
|
p_decoder = create_text_decoder(); |
|
|
p_decoder = create_text_decoder(); |
|
|
|
|
|
|
|
|
|
|
|
count_characters = 0; |
|
|
return text_decoder_decode_string(p_decoder, text, -1, ESPEAKNG_ENCODING_UTF_8); |
|
|
return text_decoder_decode_string(p_decoder, text, -1, ESPEAKNG_ENCODING_UTF_8); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
printf("testing Latin (Latn)\n"); |
|
|
printf("testing Latin (Latn)\n"); |
|
|
|
|
|
|
|
|
assert(clause_type_from_codepoint('a') == CLAUSE_NONE); |
|
|
|
|
|
assert(clause_type_from_codepoint('.') == CLAUSE_PERIOD); |
|
|
|
|
|
assert(clause_type_from_codepoint('?') == CLAUSE_QUESTION); |
|
|
assert(clause_type_from_codepoint('?') == CLAUSE_QUESTION); |
|
|
assert(clause_type_from_codepoint('!') == CLAUSE_EXCLAMATION); |
|
|
assert(clause_type_from_codepoint('!') == CLAUSE_EXCLAMATION); |
|
|
assert(clause_type_from_codepoint(',') == CLAUSE_COMMA); |
|
|
assert(clause_type_from_codepoint(',') == CLAUSE_COMMA); |
|
|
|
|
|
|
|
|
assert(clause_type_from_codepoint(0x2026) == (CLAUSE_SEMICOLON | CLAUSE_SPEAK_PUNCTUATION_NAME | CLAUSE_OPTIONAL_SPACE_AFTER)); |
|
|
assert(clause_type_from_codepoint(0x2026) == (CLAUSE_SEMICOLON | CLAUSE_SPEAK_PUNCTUATION_NAME | CLAUSE_OPTIONAL_SPACE_AFTER)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
test_latin_sentence() |
|
|
|
|
|
{ |
|
|
|
|
|
printf("testing Latin (Latn) ... sentence\n"); |
|
|
|
|
|
|
|
|
|
|
|
assert(clause_type_from_codepoint('a') == CLAUSE_NONE); |
|
|
|
|
|
assert(clause_type_from_codepoint('.') == CLAUSE_PERIOD); |
|
|
|
|
|
|
|
|
|
|
|
short retix[] = { |
|
|
|
|
|
0, 2, 3, 4, 5, 6, // Jane |
|
|
|
|
|
0, 8, 9, 10, 11, 12, 13, 14, 15, // finished |
|
|
|
|
|
0, 17, 18, // #1 |
|
|
|
|
|
0, 20, 21, // in |
|
|
|
|
|
0, 23, 24, 25, // the |
|
|
|
|
|
0, 27, 28, 29, 30, // race |
|
|
|
|
|
0 }; |
|
|
|
|
|
|
|
|
|
|
|
assert(set_text("Janet finished #1 in the race.", "en") == ENS_OK); |
|
|
|
|
|
|
|
|
|
|
|
charix_top = 0; |
|
|
|
|
|
assert(ReadClause(translator, source, charix, &charix_top, N_TR_SOURCE, &tone2, voice_change_name) == (CLAUSE_PERIOD | CLAUSE_DOT_AFTER_LAST_WORD)); |
|
|
|
|
|
assert(!strcmp(source, "Janet finished #1 in the race ")); |
|
|
|
|
|
assert(charix_top == (sizeof(retix)/sizeof(retix[0])) - 2); |
|
|
|
|
|
assert(!memcmp(charix, retix, sizeof(retix))); |
|
|
|
|
|
assert(tone2 == 0); |
|
|
|
|
|
assert(voice_change_name[0] == 0); |
|
|
|
|
|
|
|
|
|
|
|
charix_top = 0; |
|
|
|
|
|
assert(ReadClause(translator, source, charix, &charix_top, N_TR_SOURCE, &tone2, voice_change_name) == CLAUSE_EOF); |
|
|
|
|
|
assert(!strcmp(source, " ")); |
|
|
|
|
|
assert(charix_top == 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void |
|
|
void |
|
|
test_greek() |
|
|
test_greek() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
"\xF0\x9F\x90\xAC", // [1F42C] dolphin |
|
|
"\xF0\x9F\x90\xAC", // [1F42C] dolphin |
|
|
"en") == ENS_OK); |
|
|
"en") == ENS_OK); |
|
|
|
|
|
|
|
|
|
|
|
charix_top = 0; |
|
|
assert(ReadClause(translator, source, charix, &charix_top, N_TR_SOURCE, &tone2, voice_change_name) == CLAUSE_EOF); |
|
|
assert(ReadClause(translator, source, charix, &charix_top, N_TR_SOURCE, &tone2, voice_change_name) == CLAUSE_EOF); |
|
|
assert(!strcmp(source, |
|
|
assert(!strcmp(source, |
|
|
"\xE2\x86\x94" // [2194] left right arrow |
|
|
"\xE2\x86\x94" // [2194] left right arrow |
|
|
|
|
|
|
|
|
assert(espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, NULL, espeakINITIALIZE_DONT_EXIT) == 22050); |
|
|
assert(espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, NULL, espeakINITIALIZE_DONT_EXIT) == 22050); |
|
|
|
|
|
|
|
|
test_latin(); |
|
|
test_latin(); |
|
|
|
|
|
test_latin_sentence(); |
|
|
|
|
|
|
|
|
test_greek(); |
|
|
test_greek(); |
|
|
test_armenian(); |
|
|
test_armenian(); |
|
|
test_arabic(); |
|
|
test_arabic(); |