iPXE
|
UTF-8 Unicode encoding tests. More...
Go to the source code of this file.
Data Structures | |
struct | utf8_accumulate_test |
A UTF-8 accumulation test. More... | |
Macros | |
#define | DATA(...) { __VA_ARGS__ } |
Define inline data. More... | |
#define | UTF8_ACCUMULATE(name, BYTES, EXPECTED) |
Define a UTF-8 accumulation test. More... | |
#define | utf8_accumulate_ok(test) utf8_accumulate_okx ( test, __FILE__, __LINE__ ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
UTF8_ACCUMULATE (ascii, "Hello world!", DATA( 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!')) | |
Basic ASCII test. More... | |
UTF8_ACCUMULATE (multibyte, "Héllô wörld 🥳", DATA( 'H', 0, L 'é', 'l', 'l', 0, L 'ô', ' ', 'w', 0, L 'ö', 'r', 'l', 'd', ' ', 0, 0, 0, 0x1f973)) | |
Multi-byte character test. More... | |
UTF8_ACCUMULATE (stray_continuation, DATA( 'a', 0x81, 'b', 0xc3, 0x82, 0x83, 'c'), DATA( 'a', 0xfffd, 'b', 0, 0xc2, 0xfffd, 'c')) | |
Stray continuation byte test. More... | |
UTF8_ACCUMULATE (missing_continuation, DATA( 'a', 0xc3, 'b', 0xe1, 0x86, 0xc3, 0x89, 'c'), DATA( 'a', 0, 'b', 0, 0, 0, 0xc9, 'c')) | |
Missing continuation byte test. More... | |
UTF8_ACCUMULATE (illegal_two, DATA( 'a', 0xc2, 0x80, 'b', 0xc1, 0xbf, 'c', 0xc0, 0x80, 'd'), DATA( 'a', 0, 0x80, 'b', 0, 0xfffd, 'c', 0, 0xfffd, 'd')) | |
Illegal two-byte sequence test. More... | |
UTF8_ACCUMULATE (illegal_three, DATA( 'a', 0xe0, 0xa0, 0x80, 'b', 0xe0, 0x9f, 0xbf, 'c', 0xe0, 0x80, 0x80, 'd'), DATA( 'a', 0, 0, 0x800, 'b', 0, 0, 0xfffd, 'c', 0, 0, 0xfffd, 'd')) | |
Illegal three-byte sequence test. More... | |
UTF8_ACCUMULATE (illegal_four, DATA( 'a', 0xf0, 0x90, 0x80, 0x80, 'b', 0xf0, 0x8f, 0xbf, 0xbf, 'c', 0xf0, 0x80, 0x80, 0x80, 'd'), DATA( 'a', 0, 0, 0, 0x10000, 'b', 0, 0, 0, 0xfffd, 'c', 0, 0, 0, 0xfffd, 'd')) | |
Illegal four-byte sequence test. More... | |
UTF8_ACCUMULATE (illegal_length, DATA( 'a', 0xf8, 0xbf, 0xbf, 0xbf, 0xbf, 'b', 0xfc, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'c', 0xfe, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'd', 0xff, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'e'), DATA( 'a', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'b', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'c', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'd', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'e')) | |
Illegal overlength sequence test. More... | |
static void | utf8_accumulate_okx (struct utf8_accumulate_test *test, const char *file, unsigned int line) |
Report UTF-8 accumulation test result. More... | |
static void | utf8_test_exec (void) |
Perform UTF-8 self-test. More... | |
Variables | |
struct self_test utf8_test | __self_test |
UTF-8 self-test. More... | |
UTF-8 Unicode encoding tests.
Definition in file utf8_test.c.
#define DATA | ( | ... | ) | { __VA_ARGS__ } |
Define inline data.
Definition at line 50 of file utf8_test.c.
#define utf8_accumulate_ok | ( | test | ) | utf8_accumulate_okx ( test, __FILE__, __LINE__ ) |
Definition at line 140 of file utf8_test.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
UTF8_ACCUMULATE | ( | ascii | , |
"Hello world!" | , | ||
DATA('H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!') | |||
) |
Basic ASCII test.
UTF8_ACCUMULATE | ( | multibyte | , |
"Héllô wörld 🥳" | , | ||
DATA('H', 0, L 'é', 'l', 'l', 0, L 'ô', ' ', 'w', 0, L 'ö', 'r', 'l', 'd', ' ', 0, 0, 0, 0x1f973) | |||
) |
Multi-byte character test.
UTF8_ACCUMULATE | ( | stray_continuation | , |
DATA('a', 0x81, 'b', 0xc3, 0x82, 0x83, 'c') | , | ||
DATA('a', 0xfffd, 'b', 0, 0xc2, 0xfffd, 'c') | |||
) |
Stray continuation byte test.
UTF8_ACCUMULATE | ( | missing_continuation | , |
DATA('a', 0xc3, 'b', 0xe1, 0x86, 0xc3, 0x89, 'c') | , | ||
DATA('a', 0, 'b', 0, 0, 0, 0xc9, 'c') | |||
) |
Missing continuation byte test.
UTF8_ACCUMULATE | ( | illegal_two | , |
DATA('a', 0xc2, 0x80, 'b', 0xc1, 0xbf, 'c', 0xc0, 0x80, 'd') | , | ||
DATA('a', 0, 0x80, 'b', 0, 0xfffd, 'c', 0, 0xfffd, 'd') | |||
) |
Illegal two-byte sequence test.
UTF8_ACCUMULATE | ( | illegal_three | , |
DATA('a', 0xe0, 0xa0, 0x80, 'b', 0xe0, 0x9f, 0xbf, 'c', 0xe0, 0x80, 0x80, 'd') | , | ||
DATA('a', 0, 0, 0x800, 'b', 0, 0, 0xfffd, 'c', 0, 0, 0xfffd, 'd') | |||
) |
Illegal three-byte sequence test.
UTF8_ACCUMULATE | ( | illegal_four | , |
DATA('a', 0xf0, 0x90, 0x80, 0x80, 'b', 0xf0, 0x8f, 0xbf, 0xbf, 'c', 0xf0, 0x80, 0x80, 0x80, 'd') | , | ||
DATA('a', 0, 0, 0, 0x10000, 'b', 0, 0, 0, 0xfffd, 'c', 0, 0, 0, 0xfffd, 'd') | |||
) |
Illegal four-byte sequence test.
UTF8_ACCUMULATE | ( | illegal_length | , |
DATA('a', 0xf8, 0xbf, 0xbf, 0xbf, 0xbf, 'b', 0xfc, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'c', 0xfe, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'd', 0xff, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 'e') | , | ||
DATA('a', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'b', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'c', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'd', 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 'e') | |||
) |
Illegal overlength sequence test.
|
static |
Report UTF-8 accumulation test result.
test | UTF-8 accumulation test |
file | Test code file |
line | Test code line |
Definition at line 123 of file utf8_test.c.
References utf8_accumulator::character, DBGC, memset(), okx, test, and utf8_accumulate().
|
static |
struct self_test utf8_test __self_test |
UTF-8 self-test.
Definition at line 161 of file utf8_test.c.