[PATCH 1/1] test: add unit test for u16_strnlen()
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Sun Dec 18 06:32:14 CET 2022
Add the missing unit test. It can be executed with:
ut unicode u16_strnlen
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
test/unicode_ut.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index d104bd5997..3547aeffe7 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);
--
2.37.2
More information about the U-Boot
mailing list