encoding.c: Support the ISO 8859-7 encoding.

This commit is contained in:
Reece H. Dunn
2017-03-28 07:17:26 +01:00
parent da301c6b35
commit 56c0b38785
3 changed files with 69 additions and 0 deletions
+34
View File
@@ -279,6 +279,39 @@ test_iso_8859_6_encoding()
destroy_text_decoder(decoder);
}
void
test_iso_8859_7_encoding()
{
printf("testing ISO-8859-7 encoding\n");
assert(espeak_ng_EncodingFromName("ISO-8859-7:1987") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("ISO-8859-7") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("ISO_8859-7") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("iso-ir-126") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("ECMA-118") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("ELOT_928") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("greek") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("greek8") == ESPEAKNG_ENCODING_ISO_8859_7);
assert(espeak_ng_EncodingFromName("csISOLatinGreek") == ESPEAKNG_ENCODING_ISO_8859_7);
espeak_ng_TEXT_DECODER *decoder = create_text_decoder();
assert(text_decoder_decode_string(decoder, "aG\x92\xA0\xDE", 5, ESPEAKNG_ENCODING_ISO_8859_7) == ENS_OK);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 'a');
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 'G');
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0x92);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0xA0);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0x03AE);
assert(text_decoder_eof(decoder) == 1);
destroy_text_decoder(decoder);
}
int
main(int argc, char **argv)
{
@@ -291,6 +324,7 @@ main(int argc, char **argv)
test_iso_8859_4_encoding();
test_iso_8859_5_encoding();
test_iso_8859_6_encoding();
test_iso_8859_7_encoding();
printf("done\n");
return EXIT_SUCCESS;