[U-Boot] [PATCH 13/15] test: tests for utf_to_lower() utf_to_upper().
Heinrich Schuchardt
xypron.glpk at gmx.de
Sat Aug 11 15:28:18 UTC 2018
Provide unit tests for utf_to_lower() utf_to_upper().
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
test/unicode_ut.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 8e8c4d189e..ae14fb0eff 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -483,6 +483,42 @@ int ut_utf16_utf8_strncpy(void)
return 0;
}
+int ut_utf_to_lower(void)
+{
+ if (utf_to_lower('@') != '@')
+ return 1;
+ if (utf_to_lower('A') != 'a')
+ return 1;
+ if (utf_to_lower('Z') != 'z')
+ return 1;
+ if (utf_to_lower('[') != '[')
+ return 1;
+ if (utf_to_lower('m') != 'm')
+ return 1;
+ /* Cyrillic letter I*/
+ if (utf_to_lower(0x0418) != 0x0438)
+ return 0;
+ return 0;
+}
+
+int ut_utf_to_upper(void)
+{
+ if (utf_to_upper('M') != 'M')
+ return 1;
+ if (utf_to_lower('`') != '`')
+ return 1;
+ if (utf_to_upper('a') != 'A')
+ return 1;
+ if (utf_to_upper('z') != 'Z')
+ return 1;
+ if (utf_to_upper('{') != '{')
+ return 1;
+ /* Cyrillic letter I */
+ if (utf_to_upper(0x0438) != 0x0418)
+ return 1;
+ return 0;
+}
+
int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int ret = 0;
@@ -500,6 +536,8 @@ int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ret |= ut_utf16_utf8_strnlen();
ret |= ut_utf16_utf8_strcpy();
ret |= ut_utf16_utf8_strncpy();
+ ret |= ut_utf_to_lower();
+ ret |= ut_utf_to_upper();
printf("Test %s\n", ret ? "failed" : "passed");
--
2.18.0
More information about the U-Boot
mailing list