aboutsummaryrefslogtreecommitdiff
path: root/test/java/net/ipv6tests/Tests.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/java/net/ipv6tests/Tests.java')
-rw-r--r--test/java/net/ipv6tests/Tests.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/java/net/ipv6tests/Tests.java b/test/java/net/ipv6tests/Tests.java
index 8f1793bb38..dd8679403e 100644
--- a/test/java/net/ipv6tests/Tests.java
+++ b/test/java/net/ipv6tests/Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -136,11 +136,17 @@ public class Tests {
/* check the time got is within 50% of the time expected */
public static void checkTime (long got, long expected) {
- dprintln ("checkTime: got " + got + " expected " + expected);
- long upper = expected + (expected / 2);
- long lower = expected - (expected / 2);
+ checkTime(got, expected, expected);
+ }
+
+ /* check the time got is between start and end, given 50% tolerance */
+ public static void checkTime(long got, long start, long end) {
+ dprintln("checkTime: got = " + got + " start = " + start + " end = " + end);
+ long upper = end + (end / 2);
+ long lower = start - (start / 2);
if (got > upper || got < lower) {
- throw new RuntimeException ("checkTime failed: got " + got + " expected " + expected);
+ throw new RuntimeException("checkTime failed: got " + got
+ + ", expected between " + start + " and " + end);
}
}