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

◆ test_gserialized2_peek_gbox_p_fails_for_unsupported_cases()

static void test_gserialized2_peek_gbox_p_fails_for_unsupported_cases ( void  )
static

Definition at line 413 of file cu_gserialized2.c.

414{
415 uint32_t i;
416
417 char *ewkt[] =
418 {
419 "MULTIPOINT ((-76.45402132523 44.225406213532), (-72 33))",
420 "LINESTRING (2.2945672355 48.85822923236, -76.45402132523 44.225406213532, -72 33)",
421 "MULTILINESTRING ((2.2945672355 48.85822923236, -76.45402132523 44.225406213532, -72 33))",
422 "MULTILINESTRING ((2.2945672355 48.85822923236, -76.45402132523 44.225406213532), (-72 33, -71 32))"
423 };
424
425 for ( i = 0; i < (sizeof ewkt/sizeof(char*)); i++ )
426 {
428 GBOX box;
429 gbox_init(&box);
430 lwgeom_drop_bbox(geom);
431
432 /* Construct a GSERIALIZED* that doesn't have a box, so that we can test the
433 * actual logic of the peek function */
434 size_t expected_size = gserialized2_from_lwgeom_size(geom);
435 GSERIALIZED* gser = lwalloc(expected_size);
436 uint8_t* ptr = (uint8_t*) gser;
437
438 ptr += 8; // Skip header
440 gser->gflags = lwflags_get_g2flags(geom->flags);
441
442 CU_ASSERT_FALSE(gserialized2_has_bbox(gser));
443 CU_ASSERT_EQUAL(LW_FAILURE, gserialized2_peek_gbox_p(gser, &box));
444
445 lwgeom_free(geom);
446 lwfree(gser);
447 }
448}
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition gbox.c:40
int gserialized2_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox)
uint8_t lwflags_get_g2flags(lwflags_t lwflags)
static size_t gserialized2_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf)
size_t gserialized2_from_lwgeom_size(const LWGEOM *geom)
Return the memory size a GSERIALIZED will occupy for a given LWGEOM.
int gserialized2_has_bbox(const GSERIALIZED *g)
Check if a GSERIALIZED has a bounding box without deserializing first.
#define LW_FAILURE
Definition liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition lwgeom.c:710
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
uint8_t gflags
Definition liblwgeom.h:446
lwflags_t flags
Definition liblwgeom.h:461

References LWGEOM::flags, gbox_init(), GSERIALIZED::gflags, gserialized2_from_lwgeom_any(), gserialized2_from_lwgeom_size(), gserialized2_has_bbox(), gserialized2_peek_gbox_p(), LW_FAILURE, LW_PARSER_CHECK_NONE, lwalloc(), lwflags_get_g2flags(), lwfree(), lwgeom_drop_bbox(), 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: