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

◆ test_gserialized1_peek_gbox_p_fails_for_unsupported_cases()

static void test_gserialized1_peek_gbox_p_fails_for_unsupported_cases ( void  )
static

Definition at line 1161 of file cu_gserialized1.c.

1162{
1163 uint32_t i;
1164
1165 char *ewkt[] =
1166 {
1167 "MULTIPOINT ((-76.45402132523 44.225406213532), (-72 33))",
1168 "LINESTRING (2.2945672355 48.85822923236, -76.45402132523 44.225406213532, -72 33)",
1169 "MULTILINESTRING ((2.2945672355 48.85822923236, -76.45402132523 44.225406213532, -72 33))",
1170 "MULTILINESTRING ((2.2945672355 48.85822923236, -76.45402132523 44.225406213532), (-72 33, -71 32))"
1171 };
1172
1173 for ( i = 0; i < (sizeof ewkt/sizeof(char*)); i++ )
1174 {
1176 GBOX box;
1177 gbox_init(&box);
1178 lwgeom_drop_bbox(geom);
1179
1180 /* Construct a GSERIALIZED* that doesn't have a box, so that we can test the
1181 * actual logic of the peek function */
1182 size_t expected_size = gserialized1_from_lwgeom_size(geom);
1183 GSERIALIZED* gser = lwalloc(expected_size);
1184 uint8_t* ptr = (uint8_t*) gser;
1185
1186 ptr += 8; // Skip header
1188 gser->gflags = lwflags_get_g1flags(geom->flags);
1189
1190 CU_ASSERT_FALSE(gserialized1_has_bbox(gser));
1191 CU_ASSERT_EQUAL(LW_FAILURE, gserialized1_peek_gbox_p(gser, &box));
1192
1193 lwgeom_free(geom);
1194 lwfree(gser);
1195 }
1196}
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition gbox.c:40
static size_t gserialized1_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf)
int gserialized1_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox)
int gserialized1_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
size_t gserialized1_from_lwgeom_size(const LWGEOM *geom)
Return the memory size a GSERIALIZED will occupy for a given LWGEOM.
uint8_t lwflags_get_g1flags(lwflags_t lwflags)
#define LW_FAILURE
Definition liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1218
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2146
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition lwgeom.c:682
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, gserialized1_from_lwgeom_any(), gserialized1_from_lwgeom_size(), gserialized1_has_bbox(), gserialized1_peek_gbox_p(), LW_FAILURE, LW_PARSER_CHECK_NONE, lwalloc(), lwflags_get_g1flags(), lwfree(), lwgeom_drop_bbox(), 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: