PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_gserialized_peek_gbox_p_no_box_when_empty()

void test_gserialized_peek_gbox_p_no_box_when_empty ( void  )

Definition at line 1111 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(), lwgeom_from_wkt(), and test_gserialized_peek_gbox_p_gets_correct_box().

Referenced by libgeom_suite_setup(), and test_gbox_same_2d().

1112 {
1113  uint32_t i;
1114 
1115  char *ewkt[] =
1116  {
1117  "POINT EMPTY",
1118  "LINESTRING EMPTY",
1119  "MULTIPOINT EMPTY",
1120  "MULTIPOINT (EMPTY)",
1121  "MULTILINESTRING EMPTY",
1122  "MULTILINESTRING (EMPTY)"
1123  };
1124 
1125  for ( i = 0; i < (sizeof ewkt/sizeof(char*)); i++ )
1126  {
1127  LWGEOM* geom = lwgeom_from_wkt(ewkt[i], LW_PARSER_CHECK_NONE);
1128  GBOX box;
1129  gbox_init(&box);
1130 
1131  GSERIALIZED* gser = gserialized_from_lwgeom(geom, NULL);
1132 
1133  CU_ASSERT_FALSE(gserialized_has_bbox(gser));
1134 
1135  CU_ASSERT_EQUAL(LW_FAILURE, gserialized_peek_gbox_p(gser, &box));
1136 
1137  lwgeom_free(geom);
1138  lwfree(gser);
1139  }
1140 }
void lwfree(void *mem)
Definition: lwutil.c:244
static int gserialized_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Definition: g_serialized.c:463
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
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:79
unsigned int uint32_t
Definition: uthash.h:78
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
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.
Here is the call graph for this function:
Here is the caller graph for this function: