[postgis-tickets] r14590 - #3422, double tests not passing on all architectures

Paul Ramsey pramsey at cleverelephant.ca
Mon Jan 11 06:30:08 PST 2016


Author: pramsey
Date: 2016-01-11 06:30:08 -0800 (Mon, 11 Jan 2016)
New Revision: 14590

Modified:
   trunk/liblwgeom/cunit/cu_tester.h
Log:
#3422, double tests not passing on all architectures



Modified: trunk/liblwgeom/cunit/cu_tester.h
===================================================================
--- trunk/liblwgeom/cunit/cu_tester.h	2016-01-11 14:29:57 UTC (rev 14589)
+++ trunk/liblwgeom/cunit/cu_tester.h	2016-01-11 14:30:08 UTC (rev 14590)
@@ -23,10 +23,11 @@
 /* Our internal callback to register Suites with the main tester */
 typedef void (*PG_SuiteSetup)(void);
 
+#define ASSERT_DOUBLE_EQUAL_TOLERANCE 10e-8
 #define ASSERT_DOUBLE_EQUAL(o,e) do { \
-  if ( o != e ) \
+  if ( fabs((double)o-(double)e) > ASSERT_DOUBLE_EQUAL_TOLERANCE ) \
     fprintf(stderr, "[%s:%d]\n Expected: %g\n Obtained: %g\n", __FILE__, __LINE__, (double)(e), (o)); \
-  CU_ASSERT_EQUAL(o,(double)e); \
+  CU_ASSERT_DOUBLE_EQUAL((double)o,(double)e,ASSERT_DOUBLE_EQUAL_TOLERANCE); \
 } while (0);
 
 #define ASSERT_INT_EQUAL(o,e) do { \



More information about the postgis-tickets mailing list