From 829b94dc988861179f09f56b6693c84fda02acd1 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Wed, 5 Jun 2024 15:52:30 +0000 Subject: treewide: Move skip_atoi function to commonlib BUG=none TEST=Build and verify on Screebo TEST=make unit-tests ``` $ make tests/commonlib/bsd/string-test [==========] tests_commonlib_bsd_string-test(tests): Running 1 test(s). [ RUN ] test_skip_atoi [ OK ] test_skip_atoi [==========] tests_commonlib_bsd_string-test(tests): 1 test(s) run. [ PASSED ] 1 test(s). ``` Change-Id: Ifaaa80d0c696a625592ce301f9e3eefb2b4dcd98 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/82910 Reviewed-by: Jakub Czapiga Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- tests/lib/string-test.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'tests/lib') diff --git a/tests/lib/string-test.c b/tests/lib/string-test.c index 621a74ceff..17bb69ab56 100644 --- a/tests/lib/string-test.c +++ b/tests/lib/string-test.c @@ -43,18 +43,6 @@ struct str_with_l_val_t { {"\t\n\r\f\v-42", -42}, }; -/* Used to test skip_atoi */ -struct str_with_u_val_t { - char *str; - uint32_t value; - uint32_t offset; -} str_with_u_val[] = { - {"42aa", 42, 2}, - {"a", 0, 0}, - {"0", 0, 1}, - {"4a2", 4, 1}, -}; - static void test_strdup(void **state) { char str[] = "Hello coreboot\n"; @@ -204,19 +192,6 @@ static void test_strncmp(void **state) assert_int_equal(0, strncmp(str, str2, str2_len - 1)); } -static void test_skip_atoi(void **state) -{ - int i; - char *ptr, *copy; - - for (i = 0; i < ARRAY_SIZE(str_with_u_val); i++) { - ptr = str_with_u_val[i].str; - copy = ptr; - assert_true(str_with_u_val[i].value == skip_atoi(&ptr)); - assert_int_equal(str_with_u_val[i].offset, ptr - copy); - } -} - static void test_strspn(void **state) { char str[] = "4213401234"; @@ -260,7 +235,6 @@ int main(void) cmocka_unit_test(test_strcpy), cmocka_unit_test(test_strcmp), cmocka_unit_test(test_strncmp), - cmocka_unit_test(test_skip_atoi), cmocka_unit_test(test_strspn), cmocka_unit_test(test_strcspn), cmocka_unit_test(test_atol), -- cgit v1.2.3