tests/kernel: Cast time difference to int32_t before abs call

Clang complains when an unsigned value is passed to abs, even though there
is an implicit cast to a signed type. Insert an explicit cast to make clang
happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2023-03-30 11:47:45 -07:00 committed by Carles Cufí
parent 3f3224d880
commit 95a5c60abf

View file

@ -239,7 +239,7 @@ static void _test_kernel_cpu_idle(int atomic)
k_cpu_idle();
}
dt = k_uptime_ticks() - t0;
zassert_true(abs(dt - dur) <= slop,
zassert_true(abs((int32_t) (dt - dur)) <= slop,
"Inaccurate wakeup, idled for %d ticks, expected %d",
dt, dur);
}