[PATCH v3 3/3] unit: Add l_memcpy test
Denis Kenzior <[email protected]> Thu, 31 Oct 2024 15:26:15 -0500
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
---
unit/test-util.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/unit/test-util.c b/unit/test-util.c
index 341c790c3731..27b0422200d0 100644
--- a/unit/test-util.c
+++ b/unit/test-util.c
@@ -288,6 +288,16 @@ static void test_roundup_pow_of_two(const void *test_data)
}
}
+static void test_l_memcpy(const void *test_data)
+{
+ static const uint8_t src[] = { 0x00, 0xff, 0xff, 0xff };
+ uint8_t dst[10];
+
+ assert(l_memcpy(dst, src, sizeof(src)) == dst);
+ assert(l_memcpy(dst, src, 0) == dst);
+ assert(l_memcpy(dst, NULL, 0) == dst);
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -313,5 +323,7 @@ int main(int argc, char *argv[])
l_test_add("roundup_pow_of_two", test_roundup_pow_of_two, NULL);
+ l_test_add("l_memcpy", test_l_memcpy, NULL);
+
return l_test_run();
}
--
2.45.2