271{
272 int i = 0;
273 struct gserialized_empty_cases {
274 const char* wkt;
275 int isempty;
276 };
277
278 struct gserialized_empty_cases cases[] = {
279 { "POINT EMPTY", 1 },
280 { "POINT(1 1)", 0 },
281 { "LINESTRING EMPTY", 1 },
282 { "MULTILINESTRING EMPTY", 1 },
283 { "MULTILINESTRING(EMPTY)", 1 },
284 { "MULTILINESTRING(EMPTY,EMPTY)", 1 },
285 { "MULTILINESTRING(EMPTY,(0 0,1 1))", 0 },
286 { "MULTILINESTRING((0 0,1 1),EMPTY)", 0 },
287 { "MULTILINESTRING(EMPTY,(0 0,1 1),EMPTY)", 0 },
288 { "MULTILINESTRING(EMPTY,EMPTY,EMPTY)", 1 },
289 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY,EMPTY))", 1 },
290 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY),POINT(1 1))", 0 },
291 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY, (0 0)),POINT EMPTY)", 0 },
292 { "GEOMETRYCOLLECTION(POLYGON EMPTY,POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
293 { "GEOMETRYCOLLECTION(POLYGON EMPTY,GEOMETRYCOLLECTION(POINT EMPTY),MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
294 { NULL, 0 }
295 };
296
297 while( cases[i].wkt )
298 {
299
303
304 CU_ASSERT_EQUAL(ie, cases[i].isempty);
307 i++;
308 }
309}
int gserialized2_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
GSERIALIZED * gserialized2_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)