PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_lwgeom_count_vertices()

static void test_lwgeom_count_vertices ( void  )
static

Definition at line 408 of file cu_libgeom.c.

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

Referenced by libgeom_suite_setup().

409 {
410  LWGEOM *geom;
411 
412  geom = lwgeom_from_wkt("MULTIPOINT(-1 -1,-1 2.5,2 2,2 -1)", LW_PARSER_CHECK_NONE);
413  CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),4);
414  lwgeom_free(geom);
415 
416  geom = lwgeom_from_wkt("SRID=1;MULTILINESTRING((-1 -131,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))", LW_PARSER_CHECK_NONE);
417  CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),16);
418  lwgeom_free(geom);
419 
420  geom = lwgeom_from_wkt("SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,211 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))", LW_PARSER_CHECK_NONE);
421  CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),30);
422  lwgeom_free(geom);
423 
424 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
int lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1189
Here is the call graph for this function:
Here is the caller graph for this function: