tests: kernel: timer_api: fix formatting specifiers in diagnostic

Several of the values passed to the conversion failure diagnostic are
unsigned and/or 32-bit values, while all format specifiers are for
signed 64-bit integers.  Make the specifiers consistent with the
argument.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-05-29 06:18:50 -05:00 committed by Carles Cufí
parent 59808445df
commit ce47c809b9

View file

@ -14,6 +14,12 @@ enum units { UNIT_ticks, UNIT_cyc, UNIT_ms, UNIT_us, UNIT_ns };
enum round { ROUND_floor, ROUND_ceil, ROUND_near };
static const char *const round_s[] = {
[ROUND_floor] = "floor",
[ROUND_ceil] = "ceil",
[ROUND_near] = "near",
};
struct test_rec {
enum units src;
enum units dst;
@ -156,9 +162,10 @@ void test_conversion(struct test_rec *t, uint64_t val)
}
zassert_true(diff <= maxdiff && diff >= mindiff,
"Convert %lld from %lldhz to %lldhz (= %lld) failed. "
"diff %lld should be in [%lld:%lld]",
val, from_hz, to_hz, result, diff, mindiff, maxdiff);
"Convert %llu (%llx) from %u Hz to %u Hz %u-bit %s\n"
"result %llu (%llx) diff %lld (%llx) should be in [%lld:%lld]",
val, val, from_hz, to_hz, t->precision, round_s[t->round],
result, result, diff, diff, mindiff, maxdiff);
}
void test_time_conversions(void)