PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_point_count()

static void test_point_count ( void  )
static

Definition at line 64 of file cu_iterator.c.

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 }
char * inputs[]
Definition: cu_iterator.c:17
static uint32_t count_points_using_iterator(LWGEOM *g)
Definition: cu_iterator.c:46
#define LW_FALSE
Definition: liblwgeom.h:77
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:923
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1235
void lwfree(void *mem)
Definition: lwutil.c:244
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define NUMTYPES
Definition: liblwgeom.h:101
unsigned int uint32_t
Definition: uthash.h:78

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().

Here is the call graph for this function:
Here is the caller graph for this function: