15 #include "CUnit/Basic.h" 52 printf(
"error converting '%s' to lwgeom\n", wkt);
62 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(0.1111 0.1111 0.1111 0)",
WKT_ISO),
"POINT ZM (0.1111 0.1111 0.1111 0)");
64 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(0 0 0 0)",
WKT_SFSQL),
"POINT(0 0)");
66 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINTM(0 0 0)",
WKT_ISO),
"POINT M (0 0 0)");
68 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINTM(0 0 0)",
WKT_SFSQL),
"POINT(0 0)");
70 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(100 100)",
WKT_ISO),
"POINT(100 100)");
72 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(100 100)",
WKT_SFSQL),
"POINT(100 100)");
74 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(100.1 100 12 12)",
WKT_ISO),
"POINT ZM (100.1 100 12 12)");
75 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(100.1 100 12 12)",
WKT_EXTENDED),
"POINT(100.1 100 12 12)");
76 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"POINT(100.1 100 12 12)",
WKT_SFSQL),
"POINT(100.1 100)");
78 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"SRID=100;POINT(100.1 100 12 12)",
WKT_SFSQL),
"POINT(100.1 100)");
79 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"SRID=100;POINT(100.1 100 12 12)",
WKT_EXTENDED),
"SRID=100;POINT(100.1 100 12 12)");
86 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"LINESTRING(1 2 3 4,5 6 7 8)",
WKT_ISO),
"LINESTRING ZM (1 2 3 4,5 6 7 8)");
87 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"LINESTRING(1 2 3,5 6 7)",
WKT_ISO),
"LINESTRING Z (1 2 3,5 6 7)");
88 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"LINESTRINGM(1 2 3,5 6 7)",
WKT_ISO),
"LINESTRING M (1 2 3,5 6 7)");
93 CU_ASSERT_STRING_EQUAL(
94 cu_wkt(
"POLYGON((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2))",
WKT_ISO),
95 "POLYGON Z ((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2))" 97 CU_ASSERT_STRING_EQUAL(
98 cu_wkt(
"POLYGON((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2))",
WKT_EXTENDED),
99 "POLYGON((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2))" 104 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"MULTIPOINT(1 2 3 4,5 6 7 8)",
WKT_ISO),
"MULTIPOINT ZM (1 2 3 4,5 6 7 8)");
105 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"MULTIPOINT(1 2 3,5 6 7)",
WKT_ISO),
"MULTIPOINT Z (1 2 3,5 6 7)");
106 CU_ASSERT_STRING_EQUAL(
cu_wkt(
"MULTIPOINTM(1 2 3,5 6 7)",
WKT_ISO),
"MULTIPOINT M (1 2 3,5 6 7)");
112 CU_ASSERT_STRING_EQUAL(
114 "MULTILINESTRING ZM ((1 2 3 4,5 6 7 8))" 116 CU_ASSERT_STRING_EQUAL(
118 "MULTILINESTRING Z ((1 2 3,5 6 7))" 120 CU_ASSERT_STRING_EQUAL(
122 "MULTILINESTRING M ((1 2 3,5 6 7))" 128 CU_ASSERT_STRING_EQUAL(
129 cu_wkt(
"MULTIPOLYGON(((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2)))",
WKT_ISO),
130 "MULTIPOLYGON Z (((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2)))" 132 CU_ASSERT_STRING_EQUAL(
133 cu_wkt(
"MULTIPOLYGON(((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2)))",
WKT_EXTENDED),
134 "MULTIPOLYGON(((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2)))" 141 CU_ASSERT_STRING_EQUAL(
142 cu_wkt(
"GEOMETRYCOLLECTION(POLYGON((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2)),POINT(.5 .5 .5),CIRCULARSTRING(.8 .8 .8,.8 .8 .8,.8 .8 .8))",
WKT_ISO),
143 "GEOMETRYCOLLECTION Z (POLYGON Z ((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2)),POINT Z (0.5 0.5 0.5),CIRCULARSTRING Z (0.8 0.8 0.8,0.8 0.8 0.8,0.8 0.8 0.8))" 145 CU_ASSERT_STRING_EQUAL(
146 cu_wkt(
"GEOMETRYCOLLECTION(MULTIPOLYGON(((100 100 2, 100 200 2, 200 200 2, 200 100 2, 100 100 2))),MULTIPOINT(.5 .5 .5,1 1 1),CURVEPOLYGON((.8 .8 .8,.8 .8 .8,.8 .8 .8)))",
WKT_ISO),
147 "GEOMETRYCOLLECTION Z (MULTIPOLYGON Z (((100 100 2,100 200 2,200 200 2,200 100 2,100 100 2))),MULTIPOINT Z (0.5 0.5 0.5,1 1 1),CURVEPOLYGON Z ((0.8 0.8 0.8,0.8 0.8 0.8,0.8 0.8 0.8)))" 151 CU_ASSERT_STRING_EQUAL(
153 "GEOMETRYCOLLECTIONM(MULTIPOINTM(0 0 0),POINTM(1 1 1))" 159 CU_ASSERT_STRING_EQUAL(
161 "CIRCULARSTRING ZM (1 2 3 4,4 5 6 7,7 8 9 0)" 163 CU_ASSERT_STRING_EQUAL(
165 "CIRCULARSTRING(1 2 3 4,4 5 6 7,7 8 9 0)" 172 CU_ASSERT_STRING_EQUAL(
173 cu_wkt(
"COMPOUNDCURVE((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING(7 8 9 0,4 3 2 1,1 2 3 4,4 5 6 7,7 8 9 0))",
WKT_ISO),
174 "COMPOUNDCURVE ZM ((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING ZM (7 8 9 0,4 3 2 1,1 2 3 4,4 5 6 7,7 8 9 0))" 180 CU_ASSERT_STRING_EQUAL(
181 cu_wkt(
"CURVEPOLYGON((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING(7 8 9 0,1 2 1 1,1 2 3 4,4 5 6 7,7 8 9 0))",
WKT_ISO),
182 "CURVEPOLYGON ZM ((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING ZM (7 8 9 0,1 2 1 1,1 2 3 4,4 5 6 7,7 8 9 0))" 188 CU_ASSERT_STRING_EQUAL(
189 cu_wkt(
"MULTICURVE((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING(1 2 3 4,4 5 6 7,7 8 9 0))",
WKT_ISO),
190 "MULTICURVE ZM ((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING ZM (1 2 3 4,4 5 6 7,7 8 9 0))" 192 CU_ASSERT_STRING_EQUAL(
193 cu_wkt(
"MULTICURVE(COMPOUNDCURVE((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING(7 8 9 0,8 9 0 0,1 2 3 4,4 5 6 7,7 8 9 0)),(1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING(1 2 3 4,4 5 6 7,7 8 9 0))",
WKT_ISO),
194 "MULTICURVE ZM (COMPOUNDCURVE ZM ((1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING ZM (7 8 9 0,8 9 0 0,1 2 3 4,4 5 6 7,7 8 9 0)),(1 2 3 4,4 5 6 7,7 8 9 0),CIRCULARSTRING ZM (1 2 3 4,4 5 6 7,7 8 9 0))" 200 CU_ASSERT_STRING_EQUAL(
201 cu_wkt(
"MULTISURFACE(((1 2 3 4,4 5 6 7,7 8 9 0)),CURVEPOLYGON((1 2 3 4,4 5 6 7,7 8 9 0)))",
WKT_ISO),
202 "MULTISURFACE ZM (((1 2 3 4,4 5 6 7,7 8 9 0)),CURVEPOLYGON ZM ((1 2 3 4,4 5 6 7,7 8 9 0)))"
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
static void test_wkt_out_multipolygon(void)
void wkt_out_suite_setup(void)
static void test_wkt_out_multisurface(void)
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
static void test_wkt_out_polygon(void)
#define LW_PARSER_CHECK_NONE
static char * cu_wkt(char *wkt, uint8_t variant)
#define PG_ADD_TEST(suite, testfunc)
static void test_wkt_out_point(void)
static void test_wkt_out_multicurve(void)
static void test_wkt_out_multilinestring(void)
static void test_wkt_out_circularstring(void)
static int clean_wkt_out_suite(void)
static void test_wkt_out_collection(void)
static void test_wkt_out_curvpolygon(void)
static int init_wkt_out_suite(void)
static void test_wkt_out_multipoint(void)
static void test_wkt_out_compoundcurve(void)
static void test_wkt_out_linestring(void)