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

◆ test_gserialized2_is_empty()

static void test_gserialized2_is_empty ( void  )
static

Definition at line 270 of file cu_gserialized2.c.

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 // i = 11;
300 LWGEOM *lw = lwgeom_from_wkt(cases[i].wkt, LW_PARSER_CHECK_NONE);
302 int ie = gserialized2_is_empty(g);
303 // printf("%s: we say %d, they say %d\n", cases[i].wkt, cases[i].isempty, ie);
304 CU_ASSERT_EQUAL(ie, cases[i].isempty);
305 lwgeom_free(lw);
306 lwfree(g);
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)
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 gserialized2_from_lwgeom(), gserialized2_is_empty(), LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), and lwgeom_from_wkt().

Referenced by gserialized2_suite_setup().

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