15 #include "CUnit/Basic.h"
82 CU_ASSERT_STRING_EQUAL(
s,
"00C00000010000000000000000000000000000000000000000000000000000000000000000");
84 cu_wkb(
"SRID=4;POINTM(1 1 1)");
85 CU_ASSERT_STRING_EQUAL(
s,
"0060000001000000043FF00000000000003FF00000000000003FF0000000000000");
90 cu_wkb(
"SRID=4326;POINT EMPTY");
105 cu_wkb(
"LINESTRING(0 0,1 1)");
106 CU_ASSERT_STRING_EQUAL(
s,
"000000000200000002000000000000000000000000000000003FF00000000000003FF0000000000000");
108 cu_wkb(
"LINESTRING(0 0 1,1 1 2,2 2 3)");
109 CU_ASSERT_STRING_EQUAL(
s,
"008000000200000003000000000000000000000000000000003FF00000000000003FF00000000000003FF00000000000004000000000000000400000000000000040000000000000004008000000000000");
111 cu_wkb(
"LINESTRING EMPTY");
112 CU_ASSERT_STRING_EQUAL(
s,
"000000000200000000");
117 cu_wkb(
"SRID=4;POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))");
118 CU_ASSERT_STRING_EQUAL(
s,
"00A000000300000004000000010000000500000000000000000000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF00000000000003FF000000000000000000000000000003FF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
120 cu_wkb(
"SRID=14;POLYGON((0 0 0 1,0 1 0 2,1 1 0 3,1 0 0 4,0 0 0 5))");
121 CU_ASSERT_STRING_EQUAL(
s,
"00E00000030000000E00000001000000050000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF0000000000000000000000000000040000000000000003FF00000000000003FF0000000000000000000000000000040080000000000003FF00000000000000000000000000000000000000000000040100000000000000000000000000000000000000000000000000000000000004014000000000000");
123 cu_wkb(
"SRID=4;POLYGON((0 0 0 1,0 1 0 2,1 1 0 3,1 0 0 4,0 0 0 5))");
124 CU_ASSERT_STRING_EQUAL(
s,
"00E00000030000000400000001000000050000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF0000000000000000000000000000040000000000000003FF00000000000003FF0000000000000000000000000000040080000000000003FF00000000000000000000000000000000000000000000040100000000000000000000000000000000000000000000000000000000000004014000000000000");
127 CU_ASSERT_STRING_EQUAL(
s,
"000000000300000000");
134 CU_ASSERT_STRING_EQUAL(
s,
"000000000300000000");
139 cu_wkb(
"SRID=4;MULTIPOINT(0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)");
140 CU_ASSERT_STRING_EQUAL(
s,
"00A000000400000004000000050080000001000000000000000000000000000000000000000000000000008000000100000000000000003FF0000000000000000000000000000000800000013FF00000000000003FF0000000000000000000000000000000800000013FF0000000000000000000000000000000000000000000000080000001000000000000000000000000000000000000000000000000");
142 cu_wkb(
"MULTIPOINT(0 0 0, 0.26794919243112270647255365849413 1 3)");
143 CU_ASSERT_STRING_EQUAL(
s,
"008000000400000002008000000100000000000000000000000000000000000000000000000000800000013FD126145E9ECD563FF00000000000004008000000000000");
145 cu_wkb(
"MULTIPOINT EMPTY");
146 CU_ASSERT_STRING_EQUAL(
s,
"000000000400000000");
153 cu_wkb(
"SRID=14;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)))");
154 CU_ASSERT_STRING_EQUAL(
s,
"00A00000060000000E000000020080000003000000010000000500000000000000000000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF00000000000003FF000000000000000000000000000003FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000030000000200000005BFF0000000000000BFF00000000000000000000000000000BFF0000000000000400000000000000000000000000000004000000000000000400000000000000000000000000000004000000000000000BFF00000000000000000000000000000BFF0000000000000BFF000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF00000000000003FF000000000000000000000000000003FF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
156 cu_wkb(
"MULTIPOLYGON EMPTY");
157 CU_ASSERT_STRING_EQUAL(
s,
"000000000600000000");
162 cu_wkb(
"SRID=14;GEOMETRYCOLLECTION(POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),POINT(1 1 1))");
163 CU_ASSERT_STRING_EQUAL(
s,
"00A00000070000000E000000020080000003000000010000000500000000000000000000000000000000000000000000000000000000000000003FF000000000000000000000000000003FF00000000000003FF000000000000000000000000000003FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000013FF00000000000003FF00000000000003FF0000000000000");
165 cu_wkb(
"GEOMETRYCOLLECTION EMPTY");
166 CU_ASSERT_STRING_EQUAL(
s,
"000000000700000000");
168 cu_wkb(
"GEOMETRYCOLLECTION(LINESTRING EMPTY)");
169 CU_ASSERT_STRING_EQUAL(
s,
"000000000700000001000000000200000000");
171 cu_wkb(
"GEOMETRYCOLLECTION(LINESTRING EMPTY, MULTILINESTRING(EMPTY,EMPTY))");
173 CU_ASSERT_STRING_EQUAL(
s,
"000000000700000002000000000200000000000000000500000002000000000200000000000000000200000000");
178 cu_wkb(
"CIRCULARSTRING(0 -2,-2 0,0 2,2 0,0 -2)");
179 CU_ASSERT_STRING_EQUAL(
s,
"0000000008000000050000000000000000C000000000000000C000000000000000000000000000000000000000000000004000000000000000400000000000000000000000000000000000000000000000C000000000000000");
181 cu_wkb(
"CIRCULARSTRING(-5 0 0 4, 0 5 1 3, 5 0 2 2, 10 -5 3 1, 15 0 4 0)");
182 CU_ASSERT_STRING_EQUAL(
s,
"00C000000800000005C014000000000000000000000000000000000000000000004010000000000000000000000000000040140000000000003FF0000000000000400800000000000040140000000000000000000000000000400000000000000040000000000000004024000000000000C01400000000000040080000000000003FF0000000000000402E000000000000000000000000000040100000000000000000000000000000");
184 cu_wkb(
"SRID=43;CIRCULARSTRING(-5 0 0 4, 0 5 1 3, 5 0 2 2, 10 -5 3 1, 15 0 4 0)");
185 CU_ASSERT_STRING_EQUAL(
s,
"00E00000080000002B00000005C014000000000000000000000000000000000000000000004010000000000000000000000000000040140000000000003FF0000000000000400800000000000040140000000000000000000000000000400000000000000040000000000000004024000000000000C01400000000000040080000000000003FF0000000000000402E000000000000000000000000000040100000000000000000000000000000");
190 cu_wkb(
"COMPOUNDCURVE(CIRCULARSTRING(0 0 0, 0.26794919243112270647255365849413 1 3, 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,2 0 0,0 0 0))");
191 CU_ASSERT_STRING_EQUAL(
s,
"0080000009000000020080000008000000030000000000000000000000000000000000000000000000003FD126145E9ECD563FF000000000000040080000000000003FE2BEC3330188673FF6A09E667F3BCD3FF00000000000000080000002000000033FE2BEC3330188673FF6A09E667F3BCD3FF0000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
196 cu_wkb(
"CURVEPOLYGON(CIRCULARSTRING(-2 0 0 0,-1 -1 1 2,0 0 2 4,1 -1 3 6,2 0 4 8,0 2 2 4,-2 0 0 0),(-1 0 1 2,0 0.5 2 4,1 0 3 6,0 1 3 4,-1 0 1 2))");
197 CU_ASSERT_STRING_EQUAL(
s,
"00C000000A0000000200C000000800000007C000000000000000000000000000000000000000000000000000000000000000BFF0000000000000BFF00000000000003FF0000000000000400000000000000000000000000000000000000000000000400000000000000040100000000000003FF0000000000000BFF00000000000004008000000000000401800000000000040000000000000000000000000000000401000000000000040200000000000000000000000000000400000000000000040000000000000004010000000000000C00000000000000000000000000000000000000000000000000000000000000000C000000200000005BFF000000000000000000000000000003FF0000000000000400000000000000000000000000000003FE0000000000000400000000000000040100000000000003FF000000000000000000000000000004008000000000000401800000000000000000000000000003FF000000000000040080000000000004010000000000000BFF000000000000000000000000000003FF00000000000004000000000000000");
static void test_wkb_out_multicurve(void)
static void test_wkb_out_collection(void)
static void cu_wkb(char *wkt)
static void test_wkb_out_compoundcurve(void)
static void test_wkb_out_linestring(void)
static void cu_wkb_empty_point_check(char *hex)
static void test_wkb_out_curvpolygon(void)
static int clean_wkb_out_suite(void)
static void test_wkb_out_multipoint(void)
static void test_wkb_out_multilinestring(void)
static void cu_wkb_from_hexwkb(char *hexwkb)
static void test_wkb_out_multisurface(void)
static int init_wkb_out_suite(void)
static void test_wkb_out_polyhedralsurface(void)
static void test_wkb_out_multipolygon(void)
void wkb_out_suite_setup(void)
static void test_wkb_out_polygon(void)
static void test_wkb_out_point(void)
static void test_wkb_out_circularstring(void)
#define PG_ADD_TEST(suite, testfunc)
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)