Skip to content
Snippets Groups Projects
Unverified Commit afe02bcb authored by Koen Zandberg's avatar Koen Zandberg
Browse files

tests/fmt: Extend test with fmt_strnlen

parent 1778dbde
No related branches found
No related tags found
No related merge requests found
......@@ -704,6 +704,17 @@ static void test_fmt_strlen(void)
TEST_ASSERT_EQUAL_INT(21, fmt_strlen(long_str));
}
static void test_fmt_strnlen(void)
{
const char *empty_str = "";
const char *short_str = "short";
const char *long_str = "this is a long string";
TEST_ASSERT_EQUAL_INT(0, fmt_strnlen(empty_str, 16));
TEST_ASSERT_EQUAL_INT(5, fmt_strnlen(short_str, 16));
TEST_ASSERT_EQUAL_INT(16, fmt_strnlen(long_str, 16));
}
static void test_fmt_str(void)
{
const char *string1 = "string1";
......@@ -778,6 +789,7 @@ Test *tests_fmt_tests(void)
new_TestFixture(test_fmt_s16_dfp),
new_TestFixture(test_fmt_s32_dfp),
new_TestFixture(test_fmt_strlen),
new_TestFixture(test_fmt_strnlen),
new_TestFixture(test_fmt_str),
new_TestFixture(test_scn_u32_dec),
new_TestFixture(test_fmt_lpad),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment