[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.5-31-g80079474d
git at osgeo.org
git at osgeo.org
Mon Feb 7 23:39:44 PST 2022
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, stable-2.5 has been updated
via 80079474dfdc516ec8262ecac1d708cf6322d6d3 (commit)
from ad333941d847141219f753e49a2ff468339a4acc (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 80079474dfdc516ec8262ecac1d708cf6322d6d3
Author: Regina Obe <lr at pcorp.us>
Date: Tue Feb 8 02:39:34 2022 -0500
Fix regress on 32-bit berrie for cu split. References #5086 for PostGIS 2.5.6
diff --git a/liblwgeom/cunit/cu_split.c b/liblwgeom/cunit/cu_split.c
index 1e9e73beb..b7bcb1e5d 100644
--- a/liblwgeom/cunit/cu_split.c
+++ b/liblwgeom/cunit/cu_split.c
@@ -15,6 +15,7 @@
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
+#include "../lwgeom_geos.h"
static void test_lwline_split_by_point_to(void)
{
@@ -79,180 +80,166 @@ static void test_lwline_split_by_point_to(void)
static void test_lwgeom_split(void)
{
- LWGEOM *geom, *blade, *ret;
+ LWGEOM *geom, *blade, *ret, *tmp1, *tmp2;
char *wkt, *in_wkt;
- geom = lwgeom_from_wkt(
-"MULTILINESTRING((-5 -2,0 0),(0 0,10 10))",
- LW_PARSER_CHECK_NONE);
+ geom = lwgeom_from_wkt("MULTILINESTRING((-5 -2,0 0),(0 0,10 10))", LW_PARSER_CHECK_NONE);
CU_ASSERT(geom != NULL);
- blade = lwgeom_from_wkt(
- "POINT(0 0)",
- LW_PARSER_CHECK_NONE);
+ blade = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE);
CU_ASSERT(blade != NULL);
ret = lwgeom_split(geom, blade);
CU_ASSERT(ret != NULL);
wkt = lwgeom_to_ewkt(ret);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(-5 -2,0 0),LINESTRING(0 0,10 10))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* See #1311 */
- geom = lwgeom_from_wkt(
- "LINESTRING(0 0,10 0,20 4,0 3)",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT(geom != NULL);
- blade = lwgeom_from_wkt("POINT(10 0)", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- CU_ASSERT(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
+ geom = lwgeom_from_wkt("LINESTRING(0 0,10 0,20 4,0 3)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT(geom != NULL);
+ blade = lwgeom_from_wkt("POINT(10 0)", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ CU_ASSERT(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(0 0,10 0),LINESTRING(10 0,20 4,0 3))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* See #2528 (1) -- memory leak test, needs valgrind to check */
- geom = lwgeom_from_wkt("SRID=1;LINESTRING(0 1,10 1)", LW_PARSER_CHECK_NONE);
- CU_ASSERT(geom != NULL);
- blade = lwgeom_from_wkt("LINESTRING(7 0,7 3)", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- CU_ASSERT(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
+ geom = lwgeom_from_wkt("SRID=1;LINESTRING(0 1,10 1)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT(geom != NULL);
+ blade = lwgeom_from_wkt("LINESTRING(7 0,7 3)", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ CU_ASSERT(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
in_wkt = "SRID=1;GEOMETRYCOLLECTION(LINESTRING(0 1,7 1),LINESTRING(7 1,10 1))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* See #2528 (2) -- memory leak test, needs valgrind to check */
- geom = lwgeom_from_wkt("SRID=1;POLYGON((0 1, 10 1, 10 10, 0 10, 0 1))", LW_PARSER_CHECK_NONE);
- CU_ASSERT(geom != NULL);
- blade = lwgeom_from_wkt("LINESTRING(7 0,7 20)", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- CU_ASSERT(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- in_wkt = "SRID=1;GEOMETRYCOLLECTION(POLYGON((7 1,0 1,0 10,7 10,7 1)),POLYGON((7 10,10 10,10 1,7 1,7 10)))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ geom = lwgeom_from_wkt("SRID=1;POLYGON((0 1, 10 1, 10 10, 0 10, 0 1))", LW_PARSER_CHECK_NONE);
+ CU_ASSERT(geom != NULL);
+ blade = lwgeom_from_wkt("LINESTRING(7 0,7 20)", LW_PARSER_CHECK_NONE);
+ tmp1 = lwgeom_split(geom, blade);
+ ret = lwgeom_normalize(tmp1);
+ lwgeom_free(tmp1);
+ CU_ASSERT(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ tmp1 = lwgeom_from_wkt(
+ "SRID=1;GEOMETRYCOLLECTION(POLYGON((7 1,0 1,0 10,7 10,7 1)),POLYGON((7 10,10 10,10 1,7 1,7 10)))",
+ LW_PARSER_CHECK_NONE);
+ tmp2 = lwgeom_normalize(tmp1);
+ in_wkt = lwgeom_to_ewkt(tmp2);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
+ lwfree(in_wkt);
+ lwgeom_free(tmp1);
+ lwgeom_free(tmp2);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* Split line by multiline */
- geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT_FATAL(geom != NULL);
- blade = lwgeom_from_wkt("MULTILINESTRING((1 1,1 -1),(2 1,2 -1,3 -1,3 1))",
- LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- if ( ! ret ) printf("%s", cu_error_msg);
- CU_ASSERT_FATAL(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- CU_ASSERT_FATAL(wkt != NULL);
+ geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT_FATAL(geom != NULL);
+ blade = lwgeom_from_wkt("MULTILINESTRING((1 1,1 -1),(2 1,2 -1,3 -1,3 1))", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ if (!ret)
+ printf("%s", cu_error_msg);
+ CU_ASSERT_FATAL(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ CU_ASSERT_FATAL(wkt != NULL);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* Split line by polygon (boundary) */
- geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT_FATAL(geom != NULL);
- blade = lwgeom_from_wkt(
-"POLYGON((1 -2,1 1,2 1,2 -1,3 -1,3 1,11 1,11 -2,1 -2))",
- LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- if ( ! ret ) printf("%s", cu_error_msg);
- CU_ASSERT_FATAL(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- CU_ASSERT_FATAL(wkt != NULL);
+ geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT_FATAL(geom != NULL);
+ blade = lwgeom_from_wkt("POLYGON((1 -2,1 1,2 1,2 -1,3 -1,3 1,11 1,11 -2,1 -2))", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ if (!ret)
+ printf("%s", cu_error_msg);
+ CU_ASSERT_FATAL(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ CU_ASSERT_FATAL(wkt != NULL);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
- /* Split line by EMPTY polygon (boundary) */
- geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT_FATAL(geom != NULL);
- blade = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- if ( ! ret ) printf("%s", cu_error_msg);
- CU_ASSERT_FATAL(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- CU_ASSERT_FATAL(wkt != NULL);
+ /* Split line by EMPTY polygon (boundary) */
+ geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT_FATAL(geom != NULL);
+ blade = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ if (!ret)
+ printf("%s", cu_error_msg);
+ CU_ASSERT_FATAL(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ CU_ASSERT_FATAL(wkt != NULL);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(0 0,10 0))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
/* Split line by multipolygon (boundary) */
- geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT_FATAL(geom != NULL);
- blade = lwgeom_from_wkt(
-"MULTIPOLYGON(((1 -1,1 1,2 1,2 -1,1 -1)),((3 -1,3 1,11 1,11 -1,3 -1)))",
- LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- if ( ! ret ) printf("%s", cu_error_msg);
- CU_ASSERT_FATAL(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- CU_ASSERT_FATAL(wkt != NULL);
+ geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT_FATAL(geom != NULL);
+ blade = lwgeom_from_wkt("MULTIPOLYGON(((1 -1,1 1,2 1,2 -1,1 -1)),((3 -1,3 1,11 1,11 -1,3 -1)))",
+ LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ if (!ret)
+ printf("%s", cu_error_msg);
+ CU_ASSERT_FATAL(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ CU_ASSERT_FATAL(wkt != NULL);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
- /* Split line by multipoint */
- geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT_FATAL(geom != NULL);
- blade = lwgeom_from_wkt("MULTIPOINT(2 0,8 0,4 0)", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- if ( ! ret ) printf("%s", cu_error_msg);
- CU_ASSERT_FATAL(ret != NULL);
- wkt = lwgeom_to_ewkt(ret);
- CU_ASSERT_FATAL(wkt != NULL);
+ /* Split line by multipoint */
+ geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT_FATAL(geom != NULL);
+ blade = lwgeom_from_wkt("MULTIPOINT(2 0,8 0,4 0)", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ if (!ret)
+ printf("%s", cu_error_msg);
+ CU_ASSERT_FATAL(ret != NULL);
+ wkt = lwgeom_to_ewkt(ret);
+ CU_ASSERT_FATAL(wkt != NULL);
in_wkt = "GEOMETRYCOLLECTION(LINESTRING(8 0,10 0),LINESTRING(0 0,2 0),LINESTRING(4 0,8 0),LINESTRING(2 0,4 0))";
- if (strcmp(in_wkt, wkt))
- fprintf(stderr, "\nExp: %s\nObt: %s\n", in_wkt, wkt);
- CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
- lwfree(wkt);
+ ASSERT_STRING_EQUAL(wkt, in_wkt);
+ lwfree(wkt);
lwgeom_free(ret);
lwgeom_free(geom);
lwgeom_free(blade);
- /* See #3401 -- robustness issue */
- geom = lwgeom_from_wkt("LINESTRING(-180 0,0 0)", LW_PARSER_CHECK_NONE);
- CU_ASSERT(geom != NULL);
- blade = lwgeom_from_wkt("POINT(-20 0)", LW_PARSER_CHECK_NONE);
- ret = lwgeom_split(geom, blade);
- CU_ASSERT(ret != NULL);
+ /* See #3401 -- robustness issue */
+ geom = lwgeom_from_wkt("LINESTRING(-180 0,0 0)", LW_PARSER_CHECK_NONE);
+ CU_ASSERT(geom != NULL);
+ blade = lwgeom_from_wkt("POINT(-20 0)", LW_PARSER_CHECK_NONE);
+ ret = lwgeom_split(geom, blade);
+ CU_ASSERT(ret != NULL);
{
LWCOLLECTION *split = lwgeom_as_lwcollection(ret);
LWLINE *l1, *l2;
@@ -274,6 +261,12 @@ static void test_lwgeom_split(void)
lwgeom_free(blade);
}
+static int
+clean_geos_split_suite(void)
+{
+ finishGEOS();
+ return 0;
+}
/*
** Used by test harness to register the tests in this file.
@@ -281,7 +274,7 @@ static void test_lwgeom_split(void)
void split_suite_setup(void);
void split_suite_setup(void)
{
- CU_pSuite suite = CU_add_suite("split", NULL, NULL);
+ CU_pSuite suite = CU_add_suite("split", NULL, clean_geos_split_suite);
PG_ADD_TEST(suite, test_lwline_split_by_point_to);
PG_ADD_TEST(suite, test_lwgeom_split);
}
-----------------------------------------------------------------------
Summary of changes:
liblwgeom/cunit/cu_split.c | 227 ++++++++++++++++++++++-----------------------
1 file changed, 110 insertions(+), 117 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list