PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void test_lwgeom_node ( void  )
static

Definition at line 19 of file cu_node.c.

References cu_error_msg_reset(), LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_node(), lwgeom_same(), and lwgeom_to_ewkt().

Referenced by node_suite_setup().

20 {
21 #if POSTGIS_GEOS_VERSION >= 33
22  LWGEOM *in, *out;
23  const char *wkt;
24  char *tmp;
25 
26  /* Because i don't trust that much prior tests... ;) */
28 
29  wkt = "LINESTRING(0 0,5 5, 10 0)";
31  out = lwgeom_node(in);
32  /* printf("%s\n", lwgeom_to_ewkt(out)); */
33  CU_ASSERT(lwgeom_same(in, out));
34  lwgeom_free(out); lwgeom_free(in);
35 
36  wkt = "MULTILINESTRING((0 0,0 5),(10 0, -10 5))";
38  out = lwgeom_node(in);
39  tmp = lwgeom_to_ewkt(out);
40  CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 2.5,-10 5),(0 0,0 2.5),(0 2.5,0 5),(10 0,0 2.5))", tmp)
41  lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
42 
43  wkt = "MULTILINESTRING((0 0,5 5,10 0, 11 0, 20 0),(10 0, 12 0, 22 0))";
45  out = lwgeom_node(in);
46  tmp = lwgeom_to_ewkt(out);
47  /* printf("%s\n", tmp); */
48  CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 0,5 5,10 0),(10 0,11 0,12 0,20 0),(20 0,22 0))", tmp);
49  lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
50 
51  wkt = "MULTILINESTRING((0 0,5 5,10 0, 11 0, 20 0),(22 0, 12 0, 10 0),(0 5, 5 0))";
52  in = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE);
53  out = lwgeom_node(in);
54  tmp = lwgeom_to_ewkt(out);
55  /* printf("%s\n", tmp); */
56  CU_ASSERT_STRING_EQUAL(
57 "MULTILINESTRING((0 0,2.5 2.5),(0 5,2.5 2.5),(22 0,20 0),(20 0,12 0,11 0,10 0),(10 0,5 5,2.5 2.5),(2.5 2.5,5 0))",
58  tmp);
59  lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
60 #endif /* POSTGIS_GEOS_VERSION >= 33 */
61 }
void lwfree(void *mem)
Definition: lwutil.c:214
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:469
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:890
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1869
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
void cu_error_msg_reset()
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:495

Here is the call graph for this function:

Here is the caller graph for this function: