diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2023-05-22 16:42:03 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2023-06-08 11:05:46 +0300 |
commit | 38d821ade86dba8b247e20716483a96b3a230a42 (patch) | |
tree | 448dcf231d9a5bb2d0d5d72ac344dd427c7bb9a2 /test | |
parent | e403f70d4ae1a499310ffd51924b0a30b7bc3aea (diff) |
validation: timer: check base frequency fraction part
Check that fraction part is less than one when used.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Shijith Thotton <sthotton@marvell.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/api/timer/timer.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 3d77793e2..6a5e44e2f 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -2430,11 +2430,15 @@ static void timer_test_periodic_capa(void) CU_ASSERT_FATAL(min_fract.integer || min_fract.numer); CU_ASSERT_FATAL(max_fract.integer || max_fract.numer); - if (min_fract.numer) + if (min_fract.numer) { CU_ASSERT_FATAL(min_fract.denom); + CU_ASSERT_FATAL(min_fract.numer < min_fract.denom); + } - if (max_fract.numer) + if (max_fract.numer) { CU_ASSERT_FATAL(max_fract.denom); + CU_ASSERT_FATAL(max_fract.numer < max_fract.denom); + } min_freq = odp_fract_u64_to_dbl(&min_fract); max_freq = odp_fract_u64_to_dbl(&max_fract); @@ -2520,8 +2524,11 @@ static void timer_test_periodic_capa(void) capa.base_freq_hz.numer != base_freq.numer || capa.base_freq_hz.denom != base_freq.denom) - if (capa.base_freq_hz.numer) + if (capa.base_freq_hz.numer) { CU_ASSERT_FATAL(capa.base_freq_hz.denom); + CU_ASSERT_FATAL(capa.base_freq_hz.numer < + capa.base_freq_hz.denom); + } CU_ASSERT(odp_fract_u64_to_dbl(&capa.base_freq_hz) >= min_freq); CU_ASSERT(odp_fract_u64_to_dbl(&capa.base_freq_hz) <= max_freq); @@ -2606,6 +2613,11 @@ static void timer_test_periodic(odp_queue_type_t queue_type, int use_first) if (ret == 0) { /* Allow 10% difference in outputted base frequency */ CU_ASSERT((freq_out > (0.9 * freq)) && (freq_out < (1.1 * freq))); + + if (periodic_capa.base_freq_hz.numer) { + CU_ASSERT_FATAL(periodic_capa.base_freq_hz.numer < + periodic_capa.base_freq_hz.denom); + } } else { CU_ASSERT(base_freq.integer == periodic_capa.base_freq_hz.integer); CU_ASSERT(base_freq.numer == periodic_capa.base_freq_hz.numer); |