PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_point_count()

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:244
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:878
static uint32_t count_points_using_iterator(LWGEOM *g)
Definition: cu_iterator.c:46
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
unsigned int uint32_t
Definition: uthash.h:78
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define NUMTYPES
Definition: liblwgeom.h:101
char * inputs[]
Definition: cu_iterator.c:17
void * lwalloc(size_t size)
Definition: lwutil.c:229
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: