PostGIS  2.5.0dev-r@@SVN_REVISION@@
void test_gserialized_peek_gbox_p_no_box_when_empty ( void  )

Definition at line 1091 of file cu_libgeom.c.

References gbox_init(), gserialized_from_lwgeom(), gserialized_has_bbox(), gserialized_peek_gbox_p(), LW_FAILURE, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), and lwgeom_from_wkt().

Referenced by libgeom_suite_setup().

1092 {
1093  uint32_t i;
1094 
1095  char *ewkt[] =
1096  {
1097  "POINT EMPTY",
1098  "LINESTRING EMPTY",
1099  "MULTIPOINT EMPTY",
1100  "MULTIPOINT (EMPTY)",
1101  "MULTILINESTRING EMPTY",
1102  "MULTILINESTRING (EMPTY)"
1103  };
1104 
1105  for ( i = 0; i < (sizeof ewkt/sizeof(char*)); i++ )
1106  {
1107  LWGEOM* geom = lwgeom_from_wkt(ewkt[i], LW_PARSER_CHECK_NONE);
1108  GBOX box;
1109  gbox_init(&box);
1110 
1111  GSERIALIZED* gser = gserialized_from_lwgeom(geom, NULL);
1112 
1113  CU_ASSERT_FALSE(gserialized_has_bbox(gser));
1114 
1115  CU_ASSERT_EQUAL(LW_FAILURE, gserialized_peek_gbox_p(gser, &box));
1116 
1117  lwgeom_free(geom);
1118  lwfree(gser);
1119  }
1120 }
void lwfree(void *mem)
Definition: lwutil.c:244
static int gserialized_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Definition: g_serialized.c:460
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
int gserialized_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
Definition: g_serialized.c:40
#define LW_FAILURE
Definition: liblwgeom.h:78
unsigned int uint32_t
Definition: uthash.h:78
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1998
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:47
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.

Here is the call graph for this function:

Here is the caller graph for this function: