diff mbox

[v3,3/3] validation: time: increase limit to check to 2 res

Message ID 1452506325-12479-4-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit a7257df625ba17c99980e18716ed9cc22335ef50
Headers show

Commit Message

Ivan Khoronzhuk Jan. 11, 2016, 9:58 a.m. UTC
In places of two conversions the error can be up to
2 resolutions, so increase validation range to 2 res.

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/validation/time/time.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index d0d198a..a64bff6 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -215,8 +215,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 */
@@ -228,8 +228,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 */
@@ -241,8 +241,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 */
@@ -283,8 +283,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 */
@@ -296,8 +296,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 */