15 #include "CUnit/Basic.h"
55 static void cu_twkb(
char *wkt, int8_t prec_xy, int8_t prec_z, int8_t prec_m, uint8_t
variant)
58 if ( ! g )
lwnotice(
"input wkt is invalid: %s", wkt);
70 static void cu_twkb_idlist(
char *wkt, int64_t *idlist, int8_t prec_xy, int8_t prec_z, int8_t prec_m, uint8_t
variant)
74 if ( ! g )
lwnotice(
"input wkt is invalid: %s", wkt);
91 cu_twkb(
"POINT EMPTY", 0, 0, 0, 0);
94 cu_twkb(
"POINT(0 0)", 0, 0, 0, 0);
97 cu_twkb(
"POINT(0 0 0 0)", 0, 0, 0, 0);
118 cu_twkb(
"POINTZ(1 1 1)", 0,1,2, 0);
122 cu_twkb(
"POINTM(1 1 1)", 0,1,2, 0);
130 cu_twkb(
"LINESTRING(0 0,1 1)", 0, 0, 0, 0);
134 cu_twkb(
"LINESTRING(0 0 1,1 1 2,2 2 3)", 0, 0, 0, 0);
143 cu_twkb(
"LINESTRING EMPTY", 0, 0, 0, 0);
150 cu_twkb(
"SRID=4;POLYGON((0 0 0, 0 1 0,1 1 0,1 0 0, 0 0 0))", 0, 0, 0, 0);
154 cu_twkb(
"SRID=14;POLYGON((0 0 0 1, 0 1 0 2,1 1 0 3,1 0 0 4, 0 0 0 5))", 0, 0, 0, 0);
158 cu_twkb(
"POLYGON EMPTY", 0, 0, 0, 0);
165 cu_twkb(
"MULTIPOINT(0 0 0, 0 1 0,1 1 0,1 0 0, 0 0 0)", 0, 0, 0, 0);
168 cu_twkb(
"MULTIPOINT(0 0 0, 0.26794919243112270647255365849413 1 3)",7 ,7 , 0, 0);
178 cu_twkb(
"MULTIPOLYGON(((0 0 0, 0 1 0,1 1 0,1 0 0, 0 0 0)),((-1 -1 0,-1 2 0,2 2 0,2 -1 0,-1 -1 0),(0 0 0, 0 1 0,1 1 0,1 0 0, 0 0 0)))", 0, 0, 0, 0);
179 ASSERT_STRING_EQUAL(
s,
"060801020105000000000200020000000100010000020501010000060006000000050005000005020200000200020000000100010000");
184 cu_twkb(
"GEOMETRYCOLLECTION(LINESTRING(1 1, 2 2), LINESTRING(3 3, 4 4), LINESTRING(5 5, 6 6))", 0, 0, 0, 0);
188 cu_twkb(
"GEOMETRYCOLLECTION(POLYGON((0 0 0, 0 1 0,1 1 0,1 0 0, 0 0 0)),POINT(1 1 1))", 0, 0, 0, 0);
192 cu_twkb(
"GEOMETRYCOLLECTION EMPTY", 0, 0, 0, 0);
250 cu_twkb_idlist(
"GEOMETRYCOLLECTION(POINT(1 1),POINT(0 0))",idlist, 0, 0, 0, 0);
static void cu_twkb_idlist(char *wkt, int64_t *idlist, int8_t prec_xy, int8_t prec_z, int8_t prec_m, uint8_t variant)
static void test_twkb_out_polygon(void)
static void cu_twkb(char *wkt, int8_t prec_xy, int8_t prec_z, int8_t prec_m, uint8_t variant)
static int init_twkb_out_suite(void)
static void test_twkb_out_multipolygon(void)
static void test_twkb_out_multipoint(void)
void twkb_out_suite_setup(void)
static void test_twkb_out_point(void)
static void test_twkb_out_multilinestring(void)
static void test_twkb_out_idlist(void)
static void test_twkb_out_linestring(void)
static int clean_twkb_out_suite(void)
static void test_twkb_out_collection(void)
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
char * hexbytes_from_bytes(const uint8_t *bytes, size_t size)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
#define LWSIZE_GET(varsize)
Macro for reading the size from the GSERIALIZED size attribute.
lwvarlena_t * lwgeom_to_twkb(const LWGEOM *geom, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an allocated string.
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
lwvarlena_t * lwgeom_to_twkb_with_idlist(const LWGEOM *geom, int64_t *idlist, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m)
Convert LWGEOM to a char* in TWKB format.
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.