[njs] Tolerate epsilon difference in the previous unit test change.

Sergey Kandaurov pluknet at nginx.com
Tue Nov 13 16:13:32 UTC 2018


details:   http://hg.nginx.org/njs/rev/52e540f16740
branches:  
changeset: 651:52e540f16740
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Tue Nov 13 15:25:00 2018 +0300
description:
Tolerate epsilon difference in the previous unit test change.

diffstat:

 njs/test/njs_unit_test.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (21 lines):

diff -r 19a9743c00c8 -r 52e540f16740 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Tue Nov 13 14:16:54 2018 +0300
+++ b/njs/test/njs_unit_test.c	Tue Nov 13 15:25:00 2018 +0300
@@ -9071,10 +9071,13 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("Math.sinh(-Infinity)"),
       nxt_string("-Infinity") },
 
-#ifndef __SUNPRO_C /* Sun C 5.15: round error */
-    { nxt_string("Math.sinh(1) - (Math.E - 1/Math.E)/2"),
-      nxt_string("0") },
-#endif
+    /*
+     * The difference is Number.EPSILON on Solaris
+     * and zero on other platforms.
+     */
+    { nxt_string("Math.abs(Math.sinh(1) - (Math.E - 1/Math.E)/2)"
+                 " <= Number.EPSILON"),
+      nxt_string("true") },
 
     { nxt_string("Math.sqrt()"),
       nxt_string("NaN") },


More information about the nginx-devel mailing list