82 LWGEOM *geom, *blade, *ret;
86 "MULTILINESTRING((-5 -2,0 0),(0 0,10 10))",
88 CU_ASSERT(geom != NULL);
92 CU_ASSERT(blade != NULL);
94 CU_ASSERT(ret != NULL);
96 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(-5 -2,0 0),LINESTRING(0 0,10 10))";
97 if (strcmp(in_wkt, wkt))
98 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
99 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
107 "LINESTRING(0 0,10 0,20 4,0 3)",
109 CU_ASSERT(geom != NULL);
112 CU_ASSERT(ret != NULL);
114 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(0 0,10 0),LINESTRING(10 0,20 4,0 3))";
115 if (strcmp(in_wkt, wkt))
116 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
117 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
125 CU_ASSERT(geom != NULL);
128 CU_ASSERT(ret != NULL);
130 in_wkt =
"SRID=1;GEOMETRYCOLLECTION(LINESTRING(0 1,7 1),LINESTRING(7 1,10 1))";
131 if (strcmp(in_wkt, wkt))
132 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
133 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
141 CU_ASSERT(geom != NULL);
144 CU_ASSERT(ret != NULL);
146 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)))";
147 if (strcmp(in_wkt, wkt))
148 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
149 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
157 CU_ASSERT_FATAL(geom != NULL);
158 blade =
lwgeom_from_wkt(
"MULTILINESTRING((1 1,1 -1),(2 1,2 -1,3 -1,3 1))",
162 CU_ASSERT_FATAL(ret != NULL);
164 CU_ASSERT_FATAL(wkt != NULL);
165 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
166 if (strcmp(in_wkt, wkt))
167 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
168 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
176 CU_ASSERT_FATAL(geom != NULL);
178 "POLYGON((1 -2,1 1,2 1,2 -1,3 -1,3 1,11 1,11 -2,1 -2))",
182 CU_ASSERT_FATAL(ret != NULL);
184 CU_ASSERT_FATAL(wkt != NULL);
185 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
186 if (strcmp(in_wkt, wkt))
187 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
188 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
196 CU_ASSERT_FATAL(geom != NULL);
200 CU_ASSERT_FATAL(ret != NULL);
202 CU_ASSERT_FATAL(wkt != NULL);
203 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(0 0,10 0))";
204 if (strcmp(in_wkt, wkt))
205 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
206 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
214 CU_ASSERT_FATAL(geom != NULL);
216 "MULTIPOLYGON(((1 -1,1 1,2 1,2 -1,1 -1)),((3 -1,3 1,11 1,11 -1,3 -1)))",
220 CU_ASSERT_FATAL(ret != NULL);
222 CU_ASSERT_FATAL(wkt != NULL);
223 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(1 0,2 0),LINESTRING(2 0,3 0),LINESTRING(3 0,10 0))";
224 if (strcmp(in_wkt, wkt))
225 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
226 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
234 CU_ASSERT_FATAL(geom != NULL);
238 CU_ASSERT_FATAL(ret != NULL);
240 CU_ASSERT_FATAL(wkt != NULL);
241 in_wkt =
"GEOMETRYCOLLECTION(LINESTRING(8 0,10 0),LINESTRING(0 0,2 0),LINESTRING(4 0,8 0),LINESTRING(2 0,4 0))";
242 if (strcmp(in_wkt, wkt))
243 fprintf(stderr,
"\nExp: %s\nObt: %s\n", in_wkt, wkt);
244 CU_ASSERT_STRING_EQUAL(wkt, in_wkt);
252 CU_ASSERT(geom != NULL);
255 CU_ASSERT(ret != NULL);
260 CU_ASSERT(split != NULL);
262 CU_ASSERT(l1 != NULL);
267 CU_ASSERT(l2 != NULL);
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
#define LW_PARSER_CHECK_NONE
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
#define ASSERT_DOUBLE_EQUAL(o, e)
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)