Index: test/mjsunit/mjsunit.js |
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js |
index 129353730ce1a8a4f111651294fb1e6cb7dc8b55..e5fb6c2586e4823297faf13e3e5baa69cb210eb5 100644 |
--- a/test/mjsunit/mjsunit.js |
+++ b/test/mjsunit/mjsunit.js |
@@ -54,6 +54,10 @@ var assertSame; |
// and the properties of non-Array objects). |
var assertEquals; |
+ |
+// The difference between expected and found value is within certain tolerance. |
+var assertEqualsDelta; |
+ |
// The found object is an Array with the same length and elements |
// as the expected object. The expected object doesn't need to be an Array, |
// as long as it's "array-ish". |
@@ -247,6 +251,12 @@ var assertUnoptimized; |
}; |
+ assertEqualsDelta = |
+ function assertEqualsDelta(expected, found, delta, name_opt) { |
+ assertTrue(Math.abs(expected - found) <= delta, name_opt); |
+ }; |
+ |
+ |
assertArrayEquals = function assertArrayEquals(expected, found, name_opt) { |
var start = ""; |
if (name_opt) { |