[U-Boot] [PATCH v2 15/17] test: tests for utf_to_lower() utf_to_upper().

Alexander Graf agraf at suse.de
Sat Sep 1 09:47:08 UTC 2018



On 31.08.18 21:31, Heinrich Schuchardt wrote:
> Provide unit tests for utf_to_lower() utf_to_upper().
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2:
> 	use ut_assert*() for testing
> ---
>  test/unicode_ut.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/test/unicode_ut.c b/test/unicode_ut.c
> index d0dbd7985a..3e4231b241 100644
> --- a/test/unicode_ut.c
> +++ b/test/unicode_ut.c
> @@ -500,6 +500,36 @@ 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'));

Please make sure you test one of the characters from the shortened list
here too.


Alex

> +#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'));
> +#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);
> 


More information about the U-Boot mailing list