mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests: unittests: add fmt_u64_dec() tests
This commit is contained in:
parent
5923f6b137
commit
be269d3773
@ -120,6 +120,42 @@ static void test_fmt_s32_dec(void)
|
||||
TEST_ASSERT_EQUAL_STRING("-9876", (char *) out);
|
||||
}
|
||||
|
||||
static void test_fmt_u64_dec_a(void)
|
||||
{
|
||||
char out[21] = "------------------";
|
||||
uint64_t val = 0;
|
||||
uint8_t chars = 0;
|
||||
|
||||
chars = fmt_u64_dec(out, val);
|
||||
TEST_ASSERT_EQUAL_INT(1, chars);
|
||||
out[chars] = '\0';
|
||||
TEST_ASSERT_EQUAL_STRING("0", (char *) out);
|
||||
}
|
||||
|
||||
static void test_fmt_u64_dec_b(void)
|
||||
{
|
||||
char out[21] = "--------------------";
|
||||
uint64_t val = 18446744073709551615LLU;
|
||||
uint8_t chars = 0;
|
||||
|
||||
chars = fmt_u64_dec(out, val);
|
||||
TEST_ASSERT_EQUAL_INT(20, chars);
|
||||
out[chars] = '\0';
|
||||
TEST_ASSERT_EQUAL_STRING("18446744073709551615", (char *) out);
|
||||
}
|
||||
|
||||
static void test_fmt_u64_dec_c(void)
|
||||
{
|
||||
char out[21] = "--------------------";
|
||||
uint64_t val = 1234567890123456789LLU;
|
||||
uint8_t chars = 0;
|
||||
|
||||
chars = fmt_u64_dec(out, val);
|
||||
TEST_ASSERT_EQUAL_INT(19, chars);
|
||||
out[chars] = '\0';
|
||||
TEST_ASSERT_EQUAL_STRING("1234567890123456789", (char *) out);
|
||||
}
|
||||
|
||||
static void test_rmt_s16_dec(void)
|
||||
{
|
||||
char out[7] = "-------";
|
||||
@ -247,6 +283,9 @@ Test *tests_fmt_tests(void)
|
||||
new_TestFixture(test_fmt_u32_hex),
|
||||
new_TestFixture(test_fmt_u64_hex),
|
||||
new_TestFixture(test_fmt_u32_dec),
|
||||
new_TestFixture(test_fmt_u64_dec_a),
|
||||
new_TestFixture(test_fmt_u64_dec_b),
|
||||
new_TestFixture(test_fmt_u64_dec_c),
|
||||
new_TestFixture(test_fmt_u16_dec),
|
||||
new_TestFixture(test_fmt_s32_dec),
|
||||
new_TestFixture(test_rmt_s16_dec),
|
||||
|
Loading…
Reference in New Issue
Block a user