tests: kernel: timer_behaviour shouldnt use fabs
Currently the timer_behavior test uses fabs. Since the C library functions being used in the kernel is restricted in Rule A.4 in the Coding Standard We should probably not use these functions in tests either. Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
This commit is contained in:
parent
743fe63651
commit
3f3c66f664
1 changed files with 3 additions and 1 deletions
|
@ -235,6 +235,8 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan
|
|||
* CONFIG_TIMER_TEST_SAMPLES;
|
||||
double time_diff_us = actual_time_us - expected_time_us
|
||||
- expected_time_drift_us;
|
||||
double time_diff_us_abs = time_diff_us >= 0.0 ? time_diff_us : -time_diff_us;
|
||||
|
||||
/* If max stddev is lower than a single clock cycle then round it up. */
|
||||
uint32_t max_stddev = MAX(k_cyc_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV);
|
||||
|
||||
|
@ -333,7 +335,7 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan
|
|||
"Standard deviation (in microseconds) outside expected bound");
|
||||
|
||||
/* Validate the timer drift (accuracy over time) is within a configurable bound */
|
||||
zassert_true(fabs(time_diff_us) < CONFIG_TIMER_TEST_MAX_DRIFT,
|
||||
zassert_true(time_diff_us_abs < CONFIG_TIMER_TEST_MAX_DRIFT,
|
||||
"Drift (in microseconds) outside expected bound");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue