PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_point_count ( void  )
static

Definition at line 64 of file cu_iterator.c.

References count_points_using_iterator(), inputs, LW_FALSE, LW_PARSER_CHECK_NONE, LW_TRUE, lwalloc(), lwfree(), lwgeom_count_vertices(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_get_type(), and NUMTYPES.

Referenced by iterator_suite_setup().

65 {
66  char* types_visited = lwalloc(NUMTYPES * sizeof(char));
67  memset(types_visited, LW_FALSE, NUMTYPES * sizeof(char));
68 
69  uint32_t i;
70  for (i = 0; i < sizeof(inputs)/sizeof(char*); i++)
71  {
73  types_visited[lwgeom_get_type(input)] = LW_TRUE;
74 
75  uint32_t itercount = count_points_using_iterator(input);
76 
77  CU_ASSERT_EQUAL(lwgeom_count_vertices(input), itercount);
78 
79  lwgeom_free(input);
80  }
81 
82  /* Assert that every valid LWGEOM type has been tested */
83  for (i = 1; i < NUMTYPES; i++)
84  {
85  CU_ASSERT_TRUE(types_visited[i]);
86  }
87 
88  lwfree(types_visited);
89 }
void lwfree(void *mem)
Definition: lwutil.c:242
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:842
static uint32_t count_points_using_iterator(LWGEOM *g)
Definition: cu_iterator.c:46
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
#define NUMTYPES
Definition: liblwgeom.h:100
char * inputs[]
Definition: cu_iterator.c:17
void * lwalloc(size_t size)
Definition: lwutil.c:227
int lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1153

Here is the call graph for this function:

Here is the caller graph for this function: