16 #include "CUnit/Basic.h" 18 #include "lwgeom_geos.h" 30 "LINESTRING(-1 -1,-1 2.5,2 2,2 -1)",
31 "MULTIPOINT(0.9 0.9,0.9 0.9,0.9 0.9,0.9 0.9,0.9 0.9,0.9 0.9)",
32 "SRID=1;MULTILINESTRING((-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))",
33 "SRID=1;MULTILINESTRING((-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))",
34 "POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
35 "SRID=4326;POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
36 "SRID=4326;POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5))",
37 "SRID=100000;POLYGON((-1 -1 3,-1 2.5 3,2 2 3,2 -1 3,-1 -1 3),(0 0 3,0 1 3,1 1 3,1 0 3,0 0 3),(-0.5 -0.5 3,-0.5 -0.4 3,-0.4 -0.4 3,-0.4 -0.5 3,-0.5 -0.5 3))",
38 "SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))",
39 "SRID=4326;GEOMETRYCOLLECTION(POINT(0 1),POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0)),MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5))))",
40 "GEOMETRYCOLLECTION( LINESTRING (1 1, 2 2), POINT EMPTY, TRIANGLE ((0 0, 1 0, 1 1, 0 0)) )",
44 for ( i = 0; i < (
sizeof ewkt/
sizeof(
char *)); i++ )
46 LWGEOM *geom_in, *geom_out;
54 fprintf(stderr,
"\nNull return from lwgeom_geos_noop with wkt: %s\n", in_ewkt);
59 if (strcmp(in_ewkt, out_ewkt))
60 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
61 CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
77 ewkt =
"MULTILINESTRING((0 0, 0 100),(0 -5, 0 0))";
86 ewkt =
"MULTILINESTRING EMPTY";
99 #if POSTGIS_GEOS_VERSION < 35 103 char *ewkt =
"MULTILINESTRING((0 0, 0 100))";
111 CU_ASSERT_EQUAL(2, geom3->ngeoms);
118 CU_ASSERT_EQUAL(8, geom3->ngeoms);
133 CU_pSuite suite = CU_add_suite(
"GEOS", NULL, NULL);
#define ASSERT_STRING_EQUAL(o, e)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_geos_noop(const LWGEOM *geom)
Convert an LWGEOM to a GEOS Geometry and convert back – for debug only.
static void test_geos_subdivide(void)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
void geos_suite_setup(void)
static void test_geos_noop(void)
#define LW_PARSER_CHECK_NONE
#define PG_ADD_TEST(suite, testfunc)
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, int maxvertices)
static void test_geos_linemerge(void)
LWGEOM * lwgeom_segmentize2d(LWGEOM *line, double dist)
void lwcollection_free(LWCOLLECTION *col)
LWGEOM * lwgeom_linemerge(const LWGEOM *geom1)