PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_geos_linemerge()

static void test_geos_linemerge ( void  )
static

Definition at line 70 of file cu_geos.c.

References ASSERT_STRING_EQUAL, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_linemerge(), and lwgeom_to_ewkt().

Referenced by geos_suite_setup().

71 {
72  char *ewkt;
73  char *out_ewkt;
74  LWGEOM *geom1;
75  LWGEOM *geom2;
76 
77  ewkt = "MULTILINESTRING((0 0, 0 100),(0 -5, 0 0))";
79  geom2 = lwgeom_linemerge(geom1);
80  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom2);
81  ASSERT_STRING_EQUAL(out_ewkt, "LINESTRING(0 -5,0 0,0 100)");
82  lwfree(out_ewkt);
83  lwgeom_free(geom1);
84  lwgeom_free(geom2);
85 
86  ewkt = "MULTILINESTRING EMPTY";
88  geom2 = lwgeom_linemerge(geom1);
89  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom2);
90  ASSERT_STRING_EQUAL(out_ewkt, "GEOMETRYCOLLECTION EMPTY");
91  lwfree(out_ewkt);
92  lwgeom_free(geom1);
93  lwgeom_free(geom2);
94 }
void lwfree(void *mem)
Definition: lwutil.c:244
#define ASSERT_STRING_EQUAL(o, e)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:518
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
LWGEOM * lwgeom_linemerge(const LWGEOM *geom1)
Here is the call graph for this function:
Here is the caller graph for this function: