]> granicus.if.org Git - postgis/commitdiff
#3422, double tests not passing on all architectures
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 11 Jan 2016 14:30:08 +0000 (14:30 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 11 Jan 2016 14:30:08 +0000 (14:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@14590 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_tester.h

index 918a0d153da9ae204952ac1dcf0b0b06e0836ad2..521bcf05a533e6f0c4417e62cdaefd4765497802 100644 (file)
@@ -23,10 +23,11 @@ void cu_error_msg_reset(void);
 /* 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 { \