PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ test_lwgeom_is_empty()

static void test_lwgeom_is_empty ( void  )
static

Definition at line 837 of file cu_libgeom.c.

References LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), and lwgeom_is_empty().

Referenced by libgeom_suite_setup().

838 {
839  LWGEOM *geom;
840 
841  geom = lwgeom_from_wkt("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))", LW_PARSER_CHECK_NONE);
842  CU_ASSERT( !lwgeom_is_empty(geom) );
843  lwgeom_free(geom);
844 
845  geom = lwgeom_from_wkt("POINT EMPTY", LW_PARSER_CHECK_NONE);
846  CU_ASSERT( lwgeom_is_empty(geom) );
847  lwgeom_free(geom);
848 
849  geom = lwgeom_from_wkt("LINESTRING EMPTY", LW_PARSER_CHECK_NONE);
850  CU_ASSERT( lwgeom_is_empty(geom) );
851  lwgeom_free(geom);
852 
853  geom = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE);
854  CU_ASSERT( lwgeom_is_empty(geom) );
855  lwgeom_free(geom);
856 
857  geom = lwgeom_from_wkt("MULTIPOINT EMPTY", LW_PARSER_CHECK_NONE);
858  CU_ASSERT( lwgeom_is_empty(geom) );
859  lwgeom_free(geom);
860 
861  geom = lwgeom_from_wkt("MULTILINESTRING EMPTY", LW_PARSER_CHECK_NONE);
862  CU_ASSERT( lwgeom_is_empty(geom) );
863  lwgeom_free(geom);
864 
865  geom = lwgeom_from_wkt("MULTIPOLYGON EMPTY", LW_PARSER_CHECK_NONE);
866  CU_ASSERT( lwgeom_is_empty(geom) );
867  lwgeom_free(geom);
868 
869  geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY, POINT EMPTY, LINESTRING EMPTY, POLYGON EMPTY, MULTIPOINT EMPTY, MULTILINESTRING EMPTY, MULTIPOLYGON EMPTY, GEOMETRYCOLLECTION(MULTIPOLYGON EMPTY))", LW_PARSER_CHECK_NONE);
870  CU_ASSERT( lwgeom_is_empty(geom) );
871  lwgeom_free(geom);
872 
873 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2004
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1393
Here is the call graph for this function:
Here is the caller graph for this function: