[postgis-tickets] [SCM] PostGIS branch main updated. 3.2.0alpha1-30-g38b77f3

git at osgeo.org git at osgeo.org
Mon Sep 27 03:16:23 PDT 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, main has been updated
       via  38b77f3a01788c1e0755fd49bc45ee4ace8c1cef (commit)
      from  ee69242d6d68f421392d146ed483e26c92596f10 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 38b77f3a01788c1e0755fd49bc45ee4ace8c1cef
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Sep 27 11:37:12 2021 +0200

    Tolerate 1e-5 units drift in closest_point_on_segment test
    
    Or it will fail on 32bit systems

diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c
index 60c23c7..d462f51 100644
--- a/liblwgeom/cunit/cu_ptarray.c
+++ b/liblwgeom/cunit/cu_ptarray.c
@@ -818,14 +818,14 @@ static void test_ptarray_closest_point_on_segment(void)
 	closest_point_on_segment(&qp, &s0, &s1, &cp);
 	ASSERT_DOUBLE_EQUAL(cp.x, 0);
 	ASSERT_DOUBLE_EQUAL(cp.y, 8);
-	ASSERT_DOUBLE_EQUAL(cp.z, 2);
+	ASSERT_DOUBLE_EQUAL_TOLERANCE(cp.z, 2, 1e-5);
 	ASSERT_DOUBLE_EQUAL(cp.m, 12);
 
 	qp.x = -0.1; qp.y = 8;
 	closest_point_on_segment(&qp, &s0, &s1, &cp);
 	ASSERT_DOUBLE_EQUAL(cp.x, 0);
 	ASSERT_DOUBLE_EQUAL(cp.y, 8);
-	ASSERT_DOUBLE_EQUAL(cp.z, 2);
+	ASSERT_DOUBLE_EQUAL_TOLERANCE(cp.z, 2, 1e-5);
 	ASSERT_DOUBLE_EQUAL(cp.m, 12);
 
 
diff --git a/liblwgeom/cunit/cu_tester.h b/liblwgeom/cunit/cu_tester.h
index ebc1681..b876c2b 100644
--- a/liblwgeom/cunit/cu_tester.h
+++ b/liblwgeom/cunit/cu_tester.h
@@ -35,6 +35,12 @@ typedef void (*PG_SuiteSetup)(void);
   CU_ASSERT_EQUAL(o,(double)e); \
 } while (0);
 
+#define ASSERT_DOUBLE_EQUAL_TOLERANCE(o,e,t) do { \
+  if ( o != e ) \
+    fprintf(stderr, "[%s:%d]\n Expected: %g\n Obtained: %g\n Difference: %.15g\n Tolerated: %.15g\n", __FILE__, __LINE__, (double)(e), (o), fabs((o)-(e)), (t)); \
+  CU_ASSERT_DOUBLE_EQUAL(o,e,t); \
+} while (0);
+
 #define ASSERT_INT_EQUAL(o,e) do { \
   if ( o != e ) \
     fprintf(stderr, "[%s:%d]\n Expected: %d\n Obtained: %d\n", __FILE__, __LINE__, (e), (o)); \

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/cunit/cu_ptarray.c | 4 ++--
 liblwgeom/cunit/cu_tester.h  | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list