aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2019-09-18 10:26:30 +0900
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-09-20 20:09:19 +0200
commit79907a4f8429aef161add59b3d026cf2c734c1aa (patch)
tree8ad759703feb0a998faa5812cac635fba10e06cc /test
parentf8062c963a6285ce04b75570a1beaec27a40aec1 (diff)
downloadu-boot-79907a4f8429aef161add59b3d026cf2c734c1aa.zip
u-boot-79907a4f8429aef161add59b3d026cf2c734c1aa.tar.gz
u-boot-79907a4f8429aef161add59b3d026cf2c734c1aa.tar.bz2
test: add tests for u16_str<n>cmp()
New seven test cases for u16_str<n>cmp() are added under Unicode unit test, which should be executed by "ut unicode" command. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/unicode_ut.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 1ccd36e..8875cdc 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -567,6 +567,19 @@ static int unicode_test_utf_to_upper(struct unit_test_state *uts)
}
UNICODE_TEST(unicode_test_utf_to_upper);
+static int unicode_test_u16_strncmp(struct unit_test_state *uts)
+{
+ ut_assert(u16_strncmp(L"abc", L"abc", 3) == 0);
+ ut_assert(u16_strncmp(L"abcdef", L"abcghi", 3) == 0);
+ ut_assert(u16_strncmp(L"abcdef", L"abcghi", 6) < 0);
+ ut_assert(u16_strncmp(L"abcghi", L"abcdef", 6) > 0);
+ ut_assert(u16_strcmp(L"abc", L"abc") == 0);
+ ut_assert(u16_strcmp(L"abcdef", L"deghi") < 0);
+ ut_assert(u16_strcmp(L"deghi", L"abcdef") > 0);
+ return 0;
+}
+UNICODE_TEST(unicode_test_u16_strncmp);
+
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);