PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ test_twkb_out_idlist()

static void test_twkb_out_idlist ( void  )
static

Definition at line 196 of file cu_out_twkb.c.

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

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

Referenced by twkb_out_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: