diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-09-04 19:34:57 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-09-23 21:55:29 +0200 |
commit | 1a1012a1c602a66ddd35a9ae3d193c22cf786355 (patch) | |
tree | da5c02f3dd9ab99bd0d6546b64c3d0cc321cd247 /test | |
parent | b5130a81251d338be96e02134d6fca7c00229e07 (diff) |
test: tests for utf_to_lower() utf_to_upper().
Provide unit tests for utf_to_lower() utf_to_upper().
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/unicode_ut.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unicode_ut.c b/test/unicode_ut.c index d0dbd7985a..b94b4a651f 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -500,6 +500,40 @@ int ut_utf16_utf8_strncpy(struct unit_test_state *uts) } UNICODE_TEST(ut_utf16_utf8_strncpy); +int ut_utf_to_lower(struct unit_test_state *uts) +{ + ut_asserteq('@', utf_to_lower('@')); + ut_asserteq('a', utf_to_lower('A')); + ut_asserteq('z', utf_to_lower('Z')); + ut_asserteq('[', utf_to_lower('[')); + ut_asserteq('m', utf_to_lower('m')); + /* Latin letter O with diaresis (umlaut) */ + ut_asserteq(0x00f6, utf_to_lower(0x00d6)); +#ifdef CONFIG_EFI_UNICODE_CAPITALIZATION + /* Cyrillic letter I*/ + ut_asserteq(0x0438, utf_to_lower(0x0418)); +#endif + return 0; +} +UNICODE_TEST(ut_utf_to_lower); + +int ut_utf_to_upper(struct unit_test_state *uts) +{ + ut_asserteq('`', utf_to_upper('`')); + ut_asserteq('A', utf_to_upper('a')); + ut_asserteq('Z', utf_to_upper('z')); + ut_asserteq('{', utf_to_upper('{')); + ut_asserteq('M', utf_to_upper('M')); + /* Latin letter O with diaresis (umlaut) */ + ut_asserteq(0x00d6, utf_to_upper(0x00f6)); +#ifdef CONFIG_EFI_UNICODE_CAPITALIZATION + /* Cyrillic letter I */ + ut_asserteq(0x0418, utf_to_upper(0x0438)); +#endif + return 0; +} +UNICODE_TEST(ut_utf_to_upper); + int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct unit_test *tests = ll_entry_start(struct unit_test, unicode_test); |