PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_gserialized1_is_empty()

static void test_gserialized1_is_empty ( void  )
static

Definition at line 300 of file cu_gserialized1.c.

301{
302 int i = 0;
303 struct gserialized_empty_cases {
304 const char* wkt;
305 int isempty;
306 };
307
308 struct gserialized_empty_cases cases[] = {
309 { "POINT EMPTY", 1 },
310 { "POINT(1 1)", 0 },
311 { "LINESTRING EMPTY", 1 },
312 { "MULTILINESTRING EMPTY", 1 },
313 { "MULTILINESTRING(EMPTY)", 1 },
314 { "MULTILINESTRING(EMPTY,EMPTY)", 1 },
315 { "MULTILINESTRING(EMPTY,(0 0,1 1))", 0 },
316 { "MULTILINESTRING((0 0,1 1),EMPTY)", 0 },
317 { "MULTILINESTRING(EMPTY,(0 0,1 1),EMPTY)", 0 },
318 { "MULTILINESTRING(EMPTY,EMPTY,EMPTY)", 1 },
319 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY,EMPTY))", 1 },
320 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY),POINT(1 1))", 0 },
321 { "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY, (0 0)),POINT EMPTY)", 0 },
322 { "GEOMETRYCOLLECTION(POLYGON EMPTY,POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
323 { "GEOMETRYCOLLECTION(POLYGON EMPTY,GEOMETRYCOLLECTION(POINT EMPTY),MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
324 { NULL, 0 }
325 };
326
327 while( cases[i].wkt )
328 {
329 // i = 11;
330 LWGEOM *lw = lwgeom_from_wkt(cases[i].wkt, LW_PARSER_CHECK_NONE);
332 int ie = gserialized1_is_empty(g);
333 // printf("%s: we say %d, they say %d\n", cases[i].wkt, cases[i].isempty, ie);
334 CU_ASSERT_EQUAL(ie, cases[i].isempty);
335 lwgeom_free(lw);
336 lwfree(g);
337 i++;
338 }
339}
int gserialized1_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
GSERIALIZED * gserialized1_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940

References gserialized1_from_lwgeom(), gserialized1_is_empty(), LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), and lwgeom_from_wkt().

Referenced by gserialized1_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: