PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ test_twkb_out_idlist()

static void test_twkb_out_idlist ( void  )
static

Definition at line 200 of file cu_out_twkb.c.

References cu_twkb_idlist(), s, TWKB_BBOX, twkb_out_suite_setup(), TWKB_SIZE, and w.

Referenced by twkb_out_suite_setup().

201 {
202  int64_t idlist[2];
203 
204  idlist[0] = 2;
205  idlist[1] = 4;
206  cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, 0);
207  // printf("TWKB: %s\n",s);
208  // printf("WKT: %s\n",w);
209  CU_ASSERT_STRING_EQUAL(s,"040402040802020101");
210  CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");
211 
212  /*
213  04 06 multipoint, size/idlist
214  07 size 7 bytes
215  02 two geometries
216  0408 idlist (2, 4)
217  0202 first point @ 1,1
218  0101 second point offset -1,-1
219  */
220  idlist[0] = 2;
221  idlist[1] = 4;
222  cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, TWKB_SIZE);
223  // printf("TWKB: %s\n",s);
224  // printf("WKT: %s\n",w);
225  CU_ASSERT_STRING_EQUAL(s,"04060702040802020101");
226  CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");
227 
228  /*
229  04 07 multipoint, bbox/size/idlist
230  0B size 11 bytes
231  00020002 bbox x(0,1), y(0,1)
232  02 two geometries
233  0408 idlist (2,4)
234  0202 first point @ 1,1
235  0101 seconds point offset -1,-1
236  */
237  idlist[0] = 2;
238  idlist[1] = 4;
239  cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, TWKB_SIZE | TWKB_BBOX);
240  // printf("TWKB: %s\n",s);
241  // printf("WKT: %s\n",w);
242  CU_ASSERT_STRING_EQUAL(s,"04070B0002000202040802020101");
243  CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");
244 
245  /*
246  0704 geometrycollection, idlist
247  02 two geometries
248  0408 idlist (2,4)
249  01000202 first point (type, meta, x, y)
250  01000000 second point (type, meta, x, y)
251  */
252  idlist[0] = 2;
253  idlist[1] = 4;
254  cu_twkb_idlist("GEOMETRYCOLLECTION(POINT(1 1),POINT(0 0))",idlist, 0, 0, 0, 0);
255  // printf("TWKB: %s\n",s);
256  CU_ASSERT_STRING_EQUAL(s,"07040204080100020201000000");
257  CU_ASSERT_STRING_EQUAL(w,"GEOMETRYCOLLECTION(POINT(1 1),POINT(0 0))");
258 
259  /*
260  0706 geometrycollection, size/idlist
261  0D size, 13 bytes
262  02 two geometries
263  0408 idlist (2,4)
264  0102020202 first point (type, meta, size, x, y)
265  0102020000 second point (type, meta, size, x, y)
266  */
267  idlist[0] = 2;
268  idlist[1] = 4;
269  cu_twkb_idlist("GEOMETRYCOLLECTION(POINT(1 1),POINT(0 0))",idlist, 0, 0, 0, TWKB_SIZE);
270  // printf("TWKB: %s\n",s);
271  CU_ASSERT_STRING_EQUAL(s,"07060D02040801020202020102020000");
272  CU_ASSERT_STRING_EQUAL(w,"GEOMETRYCOLLECTION(POINT(1 1),POINT(0 0))");
273 
274 }
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)
Definition: cu_out_twkb.c:72
char * s
Definition: cu_out_twkb.c:24
char * w
Definition: cu_out_twkb.c:25
#define TWKB_BBOX
Definition: liblwgeom.h:2063
#define TWKB_SIZE
Definition: liblwgeom.h:2064
Here is the call graph for this function:
Here is the caller graph for this function: