16 #include "CUnit/Basic.h"
21 static void do_test_filterm(
char *geom_txt,
char *expected,
double min,
double max)
23 LWGEOM *geom_in, *geom_out;
28 if(strcmp(expected, out_txt))
29 printf(
"%s is not equal to %s\n", expected, out_txt);
30 CU_ASSERT_STRING_EQUAL(expected, out_txt)
43 do_test_filterm(
"LINESTRING(0 0 0 0,1 1 0 2,2 2 0 5,3 1 0 3)",
"LINESTRING(1 1 0 2,3 1 0 3)",2,3);
44 do_test_filterm(
"LINESTRING(0 0 0 0,1 1 0 2,2 2 0 5,3 1 0 3)",
"LINESTRING EMPTY",10, 11);
46 do_test_filterm(
"POLYGON((0 0 0 0,1 1 0 2,5 5 0 5,3 1 0 3,0 0 0 0))",
"POLYGON((0 0 0 0,1 1 0 2,3 1 0 3,0 0 0 0))",0,4);
47 do_test_filterm(
"POLYGON((0 0 0 0,1 1 0 2,5 5 0 5,3 1 0 3,0 0 0 0))",
"POLYGON EMPTY",10, 11);
53 do_test_filterm(
"GEOMETRYCOLLECTION(POINT(1 1 1 1), LINESTRING(1 1 1 1, 1 2 1 4, 2 2 1 3), POLYGON((0 0 0 4,1 1 0 2,5 5 0 5,3 1 0 3,0 0 0 4)))",
"GEOMETRYCOLLECTION(POINT(1 1 1 1),LINESTRING(1 1 1 1,1 2 1 4,2 2 1 3),POLYGON((0 0 0 4,1 1 0 2,3 1 0 3,0 0 0 4)))",0,4);
54 do_test_filterm(
"GEOMETRYCOLLECTION(POINT(1 1 1 1), LINESTRING(1 1 1 1, 1 2 1 4, 2 2 1 3), POLYGON((0 0 0 4,1 1 0 2,5 5 0 5,3 1 0 3,0 0 0 4)))",
"GEOMETRYCOLLECTION(LINESTRING(1 2 1 4,2 2 1 3),POLYGON((0 0 0 4,1 1 0 2,3 1 0 3,0 0 0 4)))",2,4);
61 CU_pSuite suite = CU_add_suite(
"filterm",NULL,NULL);
static void do_test_filterm(char *geom_txt, char *expected, double min, double max)
static void do_test_filterm_collections(void)
static void do_test_filterm_single_geometries(void)
void filterm_suite_setup(void)
#define PG_ADD_TEST(suite, testfunc)
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_filter_m(LWGEOM *geom, double min, double max, int returnm)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)