From: Paul Ramsey Date: Mon, 11 Jan 2016 14:30:08 +0000 (+0000) Subject: #3422, double tests not passing on all architectures X-Git-Tag: 2.3.0beta1~287 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29a848a8f294692e6011ae9b5e11a27c2fc49f74;p=postgis #3422, double tests not passing on all architectures git-svn-id: http://svn.osgeo.org/postgis/trunk@14590 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_tester.h b/liblwgeom/cunit/cu_tester.h index 918a0d153..521bcf05a 100644 --- a/liblwgeom/cunit/cu_tester.h +++ b/liblwgeom/cunit/cu_tester.h @@ -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 { \