PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ test_lwgeom_is_empty()

static void test_lwgeom_is_empty ( void  )
static

Definition at line 817 of file cu_libgeom.c.

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

Referenced by libgeom_suite_setup().

818 {
819  LWGEOM *geom;
820 
821  geom = lwgeom_from_wkt("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))", LW_PARSER_CHECK_NONE);
822  CU_ASSERT( !lwgeom_is_empty(geom) );
823  lwgeom_free(geom);
824 
825  geom = lwgeom_from_wkt("POINT EMPTY", LW_PARSER_CHECK_NONE);
826  CU_ASSERT( lwgeom_is_empty(geom) );
827  lwgeom_free(geom);
828 
829  geom = lwgeom_from_wkt("LINESTRING EMPTY", LW_PARSER_CHECK_NONE);
830  CU_ASSERT( lwgeom_is_empty(geom) );
831  lwgeom_free(geom);
832 
833  geom = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE);
834  CU_ASSERT( lwgeom_is_empty(geom) );
835  lwgeom_free(geom);
836 
837  geom = lwgeom_from_wkt("MULTIPOINT EMPTY", LW_PARSER_CHECK_NONE);
838  CU_ASSERT( lwgeom_is_empty(geom) );
839  lwgeom_free(geom);
840 
841  geom = lwgeom_from_wkt("MULTILINESTRING EMPTY", LW_PARSER_CHECK_NONE);
842  CU_ASSERT( lwgeom_is_empty(geom) );
843  lwgeom_free(geom);
844 
845  geom = lwgeom_from_wkt("MULTIPOLYGON EMPTY", LW_PARSER_CHECK_NONE);
846  CU_ASSERT( lwgeom_is_empty(geom) );
847  lwgeom_free(geom);
848 
849  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);
850  CU_ASSERT( lwgeom_is_empty(geom) );
851  lwgeom_free(geom);
852 
853 }
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: