Skip to content

Commit 79a77db

Browse files
committed
tests: Add cases to the scn_u32_hex unittest
1 parent 03c05f7 commit 79a77db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/unittests/tests-fmt/tests-fmt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ static void test_fmt_u16_hex(void)
254254
TEST_ASSERT_EQUAL_INT(4, fmt_u16_hex(out, 0));
255255
TEST_ASSERT(memcmp(out, "0000zzzz", 8) == 0);
256256

257-
258257
TEST_ASSERT_EQUAL_INT(4, fmt_u16_hex(out, 0xBEEF));
259258
TEST_ASSERT(memcmp(out, "BEEFzzzz", 8) == 0);
260259
}
@@ -859,11 +858,15 @@ static void test_scn_u32_hex(void)
859858
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9-ABCD", 4));
860859
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9+ABCD", 4));
861860
TEST_ASSERT_EQUAL_INT(0xab, scn_u32_hex("AB_CD", 4));
861+
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9:3kCD", 4));
862+
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9}3kCD", 4));
863+
TEST_ASSERT_EQUAL_INT(0x9, scn_u32_hex("9?3kCD", 4));
862864

863865
/* Stop on the length argument or on the null terminator */
864866
TEST_ASSERT_EQUAL_INT(0xab12ce4f, scn_u32_hex("aB12cE4F", 8));
865867
TEST_ASSERT_EQUAL_INT(0xab1, scn_u32_hex("aB12cE4F", 3));
866868
TEST_ASSERT_EQUAL_INT(0xab12ce4f, scn_u32_hex("aB12cE4F", 9));
869+
TEST_ASSERT_EQUAL_INT(0xab, scn_u32_hex("aB", 9));
867870
}
868871

869872
static void test_fmt_lpad(void)

0 commit comments

Comments
 (0)