aboutsummaryrefslogtreecommitdiff
path: root/test/unicode_ut.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-12-18 05:32:14 +0000
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-12-20 16:06:48 +0100
commitf823e32388895efc4bce9fa64cb02d75a4510a95 (patch)
tree3cc5af9e7b15ad471f740a2119e099b34fc87317 /test/unicode_ut.c
parentf9178e19a1fe8d1bde897af4265bae2d889648db (diff)
downloadu-boot-f823e32388895efc4bce9fa64cb02d75a4510a95.zip
u-boot-f823e32388895efc4bce9fa64cb02d75a4510a95.tar.gz
u-boot-f823e32388895efc4bce9fa64cb02d75a4510a95.tar.bz2
test: add unit test for u16_strnlen()
Add the missing unit test. It can be executed with: ut unicode u16_strnlen Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'test/unicode_ut.c')
-rw-r--r--test/unicode_ut.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index d104bd5..3547aef 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -67,6 +67,17 @@ static int unicode_test_u16_strlen(struct unit_test_state *uts)
}
UNICODE_TEST(unicode_test_u16_strlen);
+static int unicode_test_u16_strnlen(struct unit_test_state *uts)
+{
+ ut_asserteq(0, u16_strnlen(c1, 0));
+ ut_asserteq(4, u16_strnlen(c1, 4));
+ ut_asserteq(6, u16_strnlen(c1, 6));
+ ut_asserteq(6, u16_strnlen(c1, 7));
+
+ return 0;
+}
+UNICODE_TEST(unicode_test_u16_strnlen);
+
static int unicode_test_u16_strdup(struct unit_test_state *uts)
{
u16 *copy = u16_strdup(c4);