PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_twkb_out_point()

static void test_twkb_out_point ( void  )
static

Definition at line 92 of file cu_out_twkb.c.

References cu_twkb(), s, TWKB_BBOX, and TWKB_SIZE.

Referenced by twkb_out_suite_setup().

93 {
94 
95  cu_twkb("POINT EMPTY", 0, 0, 0, 0);
96  CU_ASSERT_STRING_EQUAL(s,"0110");
97 
98  cu_twkb("POINT(0 0)", 0, 0, 0, 0);
99  CU_ASSERT_STRING_EQUAL(s,"01000000");
100 
101  cu_twkb("POINT(0 0 0 0)", 0, 0, 0, 0);
102  CU_ASSERT_STRING_EQUAL(s,"01080300000000");
103 
104  /* Point with bounding box */
105  cu_twkb("POINT(0 0)", 0, 0, 0, TWKB_BBOX);
106  CU_ASSERT_STRING_EQUAL(s,"0101000000000000");
107  // printf("TWKB: %s\n",s);
108 
109  /* Adding a size paramters to X/Y */
110  cu_twkb("POINT(0 0)", 0, 0, 0, TWKB_SIZE);
111  CU_ASSERT_STRING_EQUAL(s,"0102020000");
112 
113  /* Adding a size paramters to X/Y/M */
114  cu_twkb("POINTM(0 0 0)", 0, 0, 0, TWKB_SIZE);
115  CU_ASSERT_STRING_EQUAL(s,"010A0203000000");
116 
117  /* Adding a size paramters to X/Y/Z/M */
118  cu_twkb("POINT(0 0 0 0)", 0, 0, 0, TWKB_SIZE);
119  CU_ASSERT_STRING_EQUAL(s,"010A030400000000");
120 
121  /* Since the third dimension is Z it shall get a precision of 1 decimal (third argument) */
122  cu_twkb("POINTZ(1 1 1)", 0,1,2, 0);
123  CU_ASSERT_STRING_EQUAL(s,"010845020214");
124 
125  /* Since the third dimension is M it shall get a precision of 2 decimals (fourth argument) */
126  cu_twkb("POINTM(1 1 1)", 0,1,2, 0);
127  // printf("\n%s\n", s);
128  CU_ASSERT_STRING_EQUAL(s,"0108460202C801");
129 }
char * s
Definition: cu_out_twkb.c:24
static void cu_twkb(char *wkt, int8_t prec_xy, int8_t prec_z, int8_t prec_m, uint8_t variant)
Definition: cu_out_twkb.c:55
#define TWKB_BBOX
Definition: liblwgeom.h:2091
#define TWKB_SIZE
Definition: liblwgeom.h:2092
Here is the call graph for this function:
Here is the caller graph for this function: