diff options
author | Tom Rini <trini@konsulko.com> | 2023-08-08 21:38:05 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-08 21:38:05 -0400 |
commit | 1e1437d9f8b5be362afdd0212dbae6c41f53f3d8 (patch) | |
tree | 7c22536424032112c0c5e3ddce45f0333478f355 /test/unicode_ut.c | |
parent | a169438411f9277cc689c14078151aa1d1caae3c (diff) | |
parent | 70fdcc704a978acb4de5e891469825596c0d292e (diff) |
Merge branch '2023-08-08-assorted-code-corrections' into next
- A number of code corrections caught by Smatch and a few others as
well.
Diffstat (limited to 'test/unicode_ut.c')
-rw-r--r-- | test/unicode_ut.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/unicode_ut.c b/test/unicode_ut.c index b27d7116b9e..1d0d90c2d73 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -807,28 +807,28 @@ static int unicode_test_u16_strlcat(struct unit_test_state *uts) /* dest and src are empty string */ memset(buf, 0, sizeof(buf)); - ret = u16_strlcat(buf, &null_src, sizeof(buf)); - ut_asserteq(1, ret); + ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf)); + ut_asserteq(0, ret); /* dest is empty string */ memset(buf, 0, sizeof(buf)); - ret = u16_strlcat(buf, src, sizeof(buf)); - ut_asserteq(5, ret); + ret = u16_strlcat(buf, src, ARRAY_SIZE(buf)); + ut_asserteq(4, ret); ut_assert(!unicode_test_u16_strcmp(buf, src, 40)); /* src is empty string */ memset(buf, 0xCD, (sizeof(buf) - sizeof(u16))); buf[39] = 0; memcpy(buf, dest, sizeof(dest)); - ret = u16_strlcat(buf, &null_src, sizeof(buf)); - ut_asserteq(6, ret); + ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf)); + ut_asserteq(5, ret); ut_assert(!unicode_test_u16_strcmp(buf, dest, 40)); for (i = 0; i <= 40; i++) { memset(buf, 0xCD, (sizeof(buf) - sizeof(u16))); buf[39] = 0; memcpy(buf, dest, sizeof(dest)); - expected = 10; + expected = min(5, i) + 4; ret = u16_strlcat(buf, src, i); ut_asserteq(expected, ret); if (i <= 6) { |