mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/unittests/tests-fmt: add large scale test for fmt_s32_dfp()
This commit is contained in:
parent
61c62c2ed6
commit
2902e31ff8
@ -738,6 +738,15 @@ static void test_fmt_s32_dfp(void)
|
|||||||
out[act_len] = '\0';
|
out[act_len] = '\0';
|
||||||
TEST_ASSERT_EQUAL_STRING("-0.0000001", (char *)out);
|
TEST_ASSERT_EQUAL_STRING("-0.0000001", (char *)out);
|
||||||
|
|
||||||
|
val = -1;
|
||||||
|
fpp = -24;
|
||||||
|
len = fmt_s32_dfp(NULL, val, fpp);
|
||||||
|
TEST_ASSERT_EQUAL_INT(3 - fpp, len);
|
||||||
|
act_len = fmt_s32_dfp(out, val, fpp);
|
||||||
|
TEST_ASSERT_EQUAL_INT(3 - fpp, act_len);
|
||||||
|
out[act_len] = '\0';
|
||||||
|
TEST_ASSERT_EQUAL_STRING("-0.000000000000000000000001", (char *)out);
|
||||||
|
|
||||||
/* check that the buffer was not overflowed */
|
/* check that the buffer was not overflowed */
|
||||||
TEST_ASSERT_EQUAL_STRING("z", &out[28]);
|
TEST_ASSERT_EQUAL_STRING("z", &out[28]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user