test/kernel: Adjust timer test to deal with time_units macros

All of the time_units conversion routines are now macros which means the
test cannot reference them as functions. Instead, create local static
functions which call each one of them and use those instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2023-09-21 21:35:47 -07:00 committed by Carles Cufí
parent 9c47239264
commit 4269bbc4ea

View file

@ -30,9 +30,99 @@ struct test_rec {
#define TESTREC(src, dst, round, prec) { \
UNIT_##src, UNIT_##dst, prec, ROUND_##round, \
(void *)k_##src##_to_##dst##_##round##prec \
(void *)test_##src##_to_##dst##_##round##prec \
} \
#define TESTFUNC(src, dst, round, prec) \
static uint##prec##_t test_##src##_to_##dst##_##round##prec(uint##prec##_t t) { \
return k_##src##_to_##dst##_##round##prec(t); \
}
TESTFUNC(ms, cyc, floor, 32)
TESTFUNC(ms, cyc, floor, 64)
TESTFUNC(ms, cyc, near, 32)
TESTFUNC(ms, cyc, near, 64)
TESTFUNC(ms, cyc, ceil, 32)
TESTFUNC(ms, cyc, ceil, 64)
TESTFUNC(ms, ticks, floor, 32)
TESTFUNC(ms, ticks, floor, 64)
TESTFUNC(ms, ticks, near, 32)
TESTFUNC(ms, ticks, near, 64)
TESTFUNC(ms, ticks, ceil, 32)
TESTFUNC(ms, ticks, ceil, 64)
TESTFUNC(us, cyc, floor, 32)
TESTFUNC(us, cyc, floor, 64)
TESTFUNC(us, cyc, near, 32)
TESTFUNC(us, cyc, near, 64)
TESTFUNC(us, cyc, ceil, 32)
TESTFUNC(us, cyc, ceil, 64)
TESTFUNC(us, ticks, floor, 32)
TESTFUNC(us, ticks, floor, 64)
TESTFUNC(us, ticks, near, 32)
TESTFUNC(us, ticks, near, 64)
TESTFUNC(us, ticks, ceil, 32)
TESTFUNC(us, ticks, ceil, 64)
TESTFUNC(cyc, ms, floor, 32)
TESTFUNC(cyc, ms, floor, 64)
TESTFUNC(cyc, ms, near, 32)
TESTFUNC(cyc, ms, near, 64)
TESTFUNC(cyc, ms, ceil, 32)
TESTFUNC(cyc, ms, ceil, 64)
TESTFUNC(cyc, us, floor, 32)
TESTFUNC(cyc, us, floor, 64)
TESTFUNC(cyc, us, near, 32)
TESTFUNC(cyc, us, near, 64)
TESTFUNC(cyc, us, ceil, 32)
TESTFUNC(cyc, us, ceil, 64)
TESTFUNC(cyc, ticks, floor, 32)
TESTFUNC(cyc, ticks, floor, 64)
TESTFUNC(cyc, ticks, near, 32)
TESTFUNC(cyc, ticks, near, 64)
TESTFUNC(cyc, ticks, ceil, 32)
TESTFUNC(cyc, ticks, ceil, 64)
TESTFUNC(ticks, ms, floor, 32)
TESTFUNC(ticks, ms, floor, 64)
TESTFUNC(ticks, ms, near, 32)
TESTFUNC(ticks, ms, near, 64)
TESTFUNC(ticks, ms, ceil, 32)
TESTFUNC(ticks, ms, ceil, 64)
TESTFUNC(ticks, us, floor, 32)
TESTFUNC(ticks, us, floor, 64)
TESTFUNC(ticks, us, near, 32)
TESTFUNC(ticks, us, near, 64)
TESTFUNC(ticks, us, ceil, 32)
TESTFUNC(ticks, us, ceil, 64)
TESTFUNC(ticks, cyc, floor, 32)
TESTFUNC(ticks, cyc, floor, 64)
TESTFUNC(ticks, cyc, near, 32)
TESTFUNC(ticks, cyc, near, 64)
TESTFUNC(ticks, cyc, ceil, 32)
TESTFUNC(ticks, cyc, ceil, 64)
TESTFUNC(ns, cyc, floor, 32)
TESTFUNC(ns, cyc, floor, 64)
TESTFUNC(ns, cyc, near, 32)
TESTFUNC(ns, cyc, near, 64)
TESTFUNC(ns, cyc, ceil, 32)
TESTFUNC(ns, cyc, ceil, 64)
TESTFUNC(ns, ticks, floor, 32)
TESTFUNC(ns, ticks, floor, 64)
TESTFUNC(ns, ticks, near, 32)
TESTFUNC(ns, ticks, near, 64)
TESTFUNC(ns, ticks, ceil, 32)
TESTFUNC(ns, ticks, ceil, 64)
TESTFUNC(cyc, ns, floor, 32)
TESTFUNC(cyc, ns, floor, 64)
TESTFUNC(cyc, ns, near, 32)
TESTFUNC(cyc, ns, near, 64)
TESTFUNC(cyc, ns, ceil, 32)
TESTFUNC(cyc, ns, ceil, 64)
TESTFUNC(ticks, ns, floor, 32)
TESTFUNC(ticks, ns, floor, 64)
TESTFUNC(ticks, ns, near, 32)
TESTFUNC(ticks, ns, near, 64)
TESTFUNC(ticks, ns, ceil, 32)
TESTFUNC(ticks, ns, ceil, 64)
static struct test_rec tests[] = {
TESTREC(ms, cyc, floor, 32),
TESTREC(ms, cyc, floor, 64),