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

Definition at line 1087 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().

1088 {
1089  uint32_t i;
1090 
1091  char *ewkt[] =
1092  {
1093  "POINT EMPTY",
1094  "LINESTRING EMPTY",
1095  "MULTIPOINT EMPTY",
1096  "MULTIPOINT (EMPTY)",
1097  "MULTILINESTRING EMPTY",
1098  "MULTILINESTRING (EMPTY)"
1099  };
1100 
1101  for ( i = 0; i < (sizeof ewkt/sizeof(char*)); i++ )
1102  {
1103  LWGEOM* geom = lwgeom_from_wkt(ewkt[i], LW_PARSER_CHECK_NONE);
1104  GBOX box;
1105  gbox_init(&box);
1106 
1107  GSERIALIZED* gser = gserialized_from_lwgeom(geom, NULL);
1108 
1109  CU_ASSERT_FALSE(gserialized_has_bbox(gser));
1110 
1111  CU_ASSERT_EQUAL(LW_FAILURE, gserialized_peek_gbox_p(gser, &box));
1112 
1113  lwgeom_free(geom);
1114  lwfree(gser);
1115  }
1116 }
void lwfree(void *mem)
Definition: lwutil.c:242
static int gserialized_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Definition: g_serialized.c:219
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
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:33
#define LW_FAILURE
Definition: liblwgeom.h:78
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:51
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
Definition: g_serialized.c:933

Here is the call graph for this function:

Here is the caller graph for this function: