@@ -217,8 +217,8 @@ static void time_test_diff(time_cb time,
ns = ns2 - ns1;
nsdiff = odp_time_to_ns(diff);
- upper_limit = ns + res;
- lower_limit = ns - res;
+ upper_limit = ns + 2 * res;
+ lower_limit = ns - 2 * res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
/* test timestamp and interval diff */
@@ -230,8 +230,8 @@ static void time_test_diff(time_cb time,
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
nsdiff = odp_time_to_ns(diff);
- upper_limit = ns + res;
- lower_limit = ns - res;
+ upper_limit = ns + 2 * res;
+ lower_limit = ns - 2 * res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
/* test interval diff */
@@ -243,8 +243,8 @@ static void time_test_diff(time_cb time,
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
nsdiff = odp_time_to_ns(diff);
- upper_limit = ns + res;
- lower_limit = ns - res;
+ upper_limit = ns + 2 * res;
+ lower_limit = ns - 2 * res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
/* same time has to diff to 0 */
@@ -285,8 +285,8 @@ static void time_test_sum(time_cb time,
CU_ASSERT(odp_time_cmp(sum, ODP_TIME_NULL) > 0);
nssum = odp_time_to_ns(sum);
- upper_limit = ns + res;
- lower_limit = ns - res;
+ upper_limit = ns + 2 * res;
+ lower_limit = ns - 2 * res;
CU_ASSERT((nssum <= upper_limit) && (nssum >= lower_limit));
/* sum intervals */
@@ -298,8 +298,8 @@ static void time_test_sum(time_cb time,
CU_ASSERT(odp_time_cmp(sum, ODP_TIME_NULL) > 0);
nssum = odp_time_to_ns(sum);
- upper_limit = ns + res;
- lower_limit = ns - res;
+ upper_limit = ns + 2 * res;
+ lower_limit = ns - 2 * res;
CU_ASSERT((nssum <= upper_limit) && (nssum >= lower_limit));
/* test on 0 */
In places of two conversions the error can be up to 2 resolutions, so increase validation range to 2 res. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- test/validation/time/time.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)