[PATCH v7 02/16] app/test: use unit test runner for string tests
Stephen Hemminger
stephen at networkplumber.org
Sat Feb 15 20:04:30 CET 2025
Switching to unit test table makes it easier to add new tests.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test/test_string_fns.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c
index 3b311325dc..ce07c17228 100644
--- a/app/test/test_string_fns.c
+++ b/app/test/test_string_fns.c
@@ -205,16 +205,20 @@ test_rte_str_skip_leading_spaces(void)
return 0;
}
+static struct unit_test_suite test_suite = {
+ .suite_name = "String functions tests",
+ .unit_test_cases = {
+ TEST_CASE(test_rte_strsplit),
+ TEST_CASE(test_rte_strlcat),
+ TEST_CASE(test_rte_str_skip_leading_spaces),
+ TEST_CASES_END()
+ }
+};
+
static int
test_string_fns(void)
{
- if (test_rte_strsplit() < 0)
- return -1;
- if (test_rte_strlcat() < 0)
- return -1;
- if (test_rte_str_skip_leading_spaces() < 0)
- return -1;
- return 0;
+ return unit_test_suite_runner(&test_suite);
}
REGISTER_FAST_TEST(string_autotest, true, true, test_string_fns);
--
2.47.2
More information about the dev
mailing list