From 29a848a8f294692e6011ae9b5e11a27c2fc49f74 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 11 Jan 2016 14:30:08 +0000 Subject: [PATCH] #3422, double tests not passing on all architectures git-svn-id: http://svn.osgeo.org/postgis/trunk@14590 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/cunit/cu_tester.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 { \ -- 2.50.1