PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_ordering()

static void test_ordering ( void  )
static

Definition at line 219 of file cu_iterator.c.

References iterator_suite_setup(), LW_PARSER_CHECK_NONE, LW_SUCCESS, lwgeom_free(), lwgeom_from_wkt(), lwpointiterator_create(), lwpointiterator_destroy(), lwpointiterator_has_next(), lwpointiterator_next(), POINT2D::x, POINT4D::x, POINT2D::y, and POINT4D::y.

Referenced by iterator_suite_setup().

220 {
221  uint32_t i = 0;
222  LWGEOM* g = lwgeom_from_wkt("GEOMETRYCOLLECTION (POLYGON ((0 0, 0 10, 10 10, 0 10, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1)), MULTIPOINT((4 4), (3 3)))", LW_PARSER_CHECK_NONE);
223 
224  POINT2D points[] = { {.x = 0, .y = 0},
225  {.x = 0, .y = 10},
226  {.x = 10, .y = 10},
227  {.x = 0, .y = 10},
228  {.x = 0, .y = 0},
229  {.x = 1, .y = 1},
230  {.x = 1, .y = 2},
231  {.x = 2, .y = 2},
232  {.x = 2, .y = 1},
233  {.x = 1, .y = 1},
234  {.x = 4, .y = 4},
235  {.x = 3, .y = 3}
236  };
237 
239  POINT4D p;
240 
241  for (i = 0; lwpointiterator_has_next(it); i++)
242  {
243  CU_ASSERT_EQUAL(LW_SUCCESS, lwpointiterator_next(it, &p));
244  CU_ASSERT_EQUAL(p.x, points[i].x);
245  CU_ASSERT_EQUAL(p.y, points[i].y);
246  }
247 
249  lwgeom_free(g);
250 }
double x
Definition: liblwgeom.h:352
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point...
Definition: lwiterator.c:212
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
#define LW_SUCCESS
Definition: liblwgeom.h:80
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:244
unsigned int uint32_t
Definition: uthash.h:78
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
double x
Definition: liblwgeom.h:328
int lwpointiterator_has_next(LWPOINTITERATOR *s)
Returns LW_TRUE if there is another point available in the iterator.
Definition: lwiterator.c:204
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:269
double y
Definition: liblwgeom.h:328
double y
Definition: liblwgeom.h:352
Here is the call graph for this function:
Here is the caller graph for this function: