Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add cases to the scn_u32_hex unittest #20463

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tests: Add cases to the scn_u32_hex unittest
  • Loading branch information
Teufelchen1 committed Mar 12, 2024
commit 79a77dbfa0f507782ba8d171de6ca80774f1ae10
5 changes: 4 additions & 1 deletion tests/unittests/tests-fmt/tests-fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ static void test_fmt_u16_hex(void)
TEST_ASSERT_EQUAL_INT(4, fmt_u16_hex(out, 0));
TEST_ASSERT(memcmp(out, "0000zzzz", 8) == 0);


TEST_ASSERT_EQUAL_INT(4, fmt_u16_hex(out, 0xBEEF));
TEST_ASSERT(memcmp(out, "BEEFzzzz", 8) == 0);
}
Expand Down Expand Up @@ -859,11 +858,15 @@ static void test_scn_u32_hex(void)
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9-ABCD", 4));
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9+ABCD", 4));
TEST_ASSERT_EQUAL_INT(0xab, scn_u32_hex("AB_CD", 4));
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9:3kCD", 4));
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9}3kCD", 4));
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9?3kCD", 4));

/* Stop on the length argument or on the null terminator */
TEST_ASSERT_EQUAL_INT(0xab12ce4f, scn_u32_hex("aB12cE4F", 8));
TEST_ASSERT_EQUAL_INT(0xab1, scn_u32_hex("aB12cE4F", 3));
TEST_ASSERT_EQUAL_INT(0xab12ce4f, scn_u32_hex("aB12cE4F", 9));
TEST_ASSERT_EQUAL_INT(0xab, scn_u32_hex("aB", 9));
}

static void test_fmt_lpad(void)
Expand Down
Loading