All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/5] test: tests for utf_to_lower() utf_to_upper().
Date: Mon,  3 Sep 2018 18:35:39 +0200	[thread overview]
Message-ID: <20180903163541.26218-4-xypron.glpk@gmx.de> (raw)
In-Reply-To: <20180903163541.26218-1-xypron.glpk@gmx.de>

Provide unit tests for utf_to_lower() utf_to_upper().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v3:
	add test for latin letter O with diaresis
v2:
	use ut_assert*() for testing
---
 test/unicode_ut.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

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);
-- 
2.18.0

  parent reply	other threads:[~2018-09-03 16:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 16:35 [U-Boot] [PATCH v3 00/05]efi_loader: EFI_UNICODE_COLLATION_PROTOCOL Heinrich Schuchardt
2018-09-03 16:35 ` [U-Boot] [PATCH v3 1/5] efi_loader: capitalization table Heinrich Schuchardt
2018-09-03 20:54   ` Alexander Graf
2018-09-03 16:35 ` [U-Boot] [PATCH v3 2/5] lib: charset: upper/lower case conversion Heinrich Schuchardt
2018-09-03 16:35 ` Heinrich Schuchardt [this message]
2018-09-03 16:35 ` [U-Boot] [PATCH v3 4/5] efi_loader: EFI_UNICODE_COLLATION_PROTOCOL Heinrich Schuchardt
2018-09-03 21:09   ` Alexander Graf
2018-09-03 21:24     ` Heinrich Schuchardt
2018-09-03 21:26       ` Alexander Graf
2018-09-04 13:46   ` Alexander Graf
     [not found]     ` <2079463e-a243-3830-eaea-3148af637b42@gmx.de>
2018-09-04 17:20       ` [U-Boot] [Fwd] " Heinrich Schuchardt
2018-09-04 22:04       ` [U-Boot] " Alexander Graf
2018-09-04 22:28         ` Leif Lindholm
2018-09-04 22:35           ` Alexander Graf
2018-09-03 16:35 ` [U-Boot] [PATCH v3 5/5] efi_selftest: EFI_UNICODE_COLLATION_PROTOCOL Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180903163541.26218-4-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.