PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_misc_count_vertices ( void  )
static

Definition at line 68 of file liblwgeom/cunit/cu_misc.c.

References genraster::count, LW_PARSER_CHECK_NONE, lwgeom_count_vertices(), lwgeom_free(), and lwgeom_from_wkt().

Referenced by misc_suite_setup().

69 {
70  LWGEOM *geom;
71  int count;
72 
73  geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,1 1),POLYGON((0 0,0 1,1 0,0 0)),CIRCULARSTRING(0 0,0 1,1 1),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1)))", LW_PARSER_CHECK_NONE);
74  count = lwgeom_count_vertices(geom);
75  CU_ASSERT_EQUAL(count,13);
76  lwgeom_free(geom);
77 
78  geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(CIRCULARSTRING(0 0,0 1,1 1),POINT(0 0),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1,1 0,0 0)))", LW_PARSER_CHECK_NONE);
79  count = lwgeom_count_vertices(geom);
80  CU_ASSERT_EQUAL(count,9);
81  lwgeom_free(geom);
82 
83  geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", LW_PARSER_CHECK_NONE);
84  count = lwgeom_count_vertices(geom);
85  CU_ASSERT_EQUAL(count,9);
86  lwgeom_free(geom);
87 
88 
89  geom = lwgeom_from_wkt("POLYGON((0 0,1 0,0 1,0 0))", LW_PARSER_CHECK_NONE);
90  count = lwgeom_count_vertices(geom);
91  CU_ASSERT_EQUAL(count,4);
92  lwgeom_free(geom);
93 
94  geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", LW_PARSER_CHECK_NONE);
95  count = lwgeom_count_vertices(geom);
96  CU_ASSERT_EQUAL(count,9);
97  lwgeom_free(geom);
98 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:844
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
int count
Definition: genraster.py:57
int lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1072

Here is the call graph for this function:

Here is the caller graph for this function: