PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_lwgeom_as_curve ( void  )
static

Definition at line 949 of file cu_libgeom.c.

References LW_PARSER_CHECK_NONE, lwfree(), lwgeom_as_curve(), lwgeom_free(), lwgeom_from_wkt(), and lwgeom_to_ewkt().

Referenced by libgeom_suite_setup().

950 {
951  LWGEOM *geom;
952  LWGEOM *geom2;
953  char *in_ewkt, *out_ewkt;
954 
955  geom = lwgeom_from_wkt("LINESTRING(0 0, 10 0)", LW_PARSER_CHECK_NONE);
956  geom2 = lwgeom_as_curve(geom);
957  in_ewkt = "COMPOUNDCURVE((0 0,10 0))";
958  out_ewkt = lwgeom_to_ewkt(geom2);
959  if (strcmp(in_ewkt, out_ewkt))
960  fprintf(stderr, "\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
961  CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
962  lwfree(out_ewkt);
963  lwgeom_free(geom);
964  lwgeom_free(geom2);
965 
966  geom = lwgeom_from_wkt("MULTILINESTRING((0 0, 10 0))", LW_PARSER_CHECK_NONE);
967  geom2 = lwgeom_as_curve(geom);
968  in_ewkt = "MULTICURVE((0 0,10 0))";
969  out_ewkt = lwgeom_to_ewkt(geom2);
970  if (strcmp(in_ewkt, out_ewkt))
971  fprintf(stderr, "\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
972  CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
973  lwfree(out_ewkt);
974  lwgeom_free(geom);
975  lwgeom_free(geom2);
976 
977  geom = lwgeom_from_wkt("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))", LW_PARSER_CHECK_NONE);
978  geom2 = lwgeom_as_curve(geom);
979  in_ewkt = "CURVEPOLYGON((0 0,10 0,10 10,0 10,0 0))";
980  out_ewkt = lwgeom_to_ewkt(geom2);
981  if (strcmp(in_ewkt, out_ewkt))
982  fprintf(stderr, "\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
983  CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
984  lwfree(out_ewkt);
985  lwgeom_free(geom);
986  lwgeom_free(geom2);
987 
988  geom = lwgeom_from_wkt("MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))", LW_PARSER_CHECK_NONE);
989  geom2 = lwgeom_as_curve(geom);
990  in_ewkt = "MULTISURFACE(((0 0,10 0,10 10,0 10,0 0)))";
991  out_ewkt = lwgeom_to_ewkt(geom2);
992  if (strcmp(in_ewkt, out_ewkt))
993  fprintf(stderr, "\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
994  CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
995  lwfree(out_ewkt);
996  lwgeom_free(geom);
997  lwgeom_free(geom2);
998 
999 }
void lwfree(void *mem)
Definition: lwutil.c:242
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:482
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
LWGEOM * lwgeom_as_curve(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate CURVE* type.
Definition: lwgeom.c:337

Here is the call graph for this function:

Here is the caller graph for this function: