PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_geometry_type_from_string ( void  )
static

Definition at line 353 of file cu_libgeom.c.

References COLLECTIONTYPE, geometry_type_from_string(), LINETYPE, LW_FAILURE, LW_SUCCESS, MULTIPOLYGONTYPE, and POINTTYPE.

Referenced by libgeom_suite_setup().

354 {
355  int rv;
356  uint8_t type = 0;
357  int z = 0, m = 0;
358  char *str;
359 
360  str = " POINTZ";
361  rv = geometry_type_from_string(str, &type, &z, &m);
362  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
363  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
364  CU_ASSERT_EQUAL(type, POINTTYPE);
365  CU_ASSERT_EQUAL(z, 1);
366  CU_ASSERT_EQUAL(m, 0);
367 
368  str = "LINESTRINGM ";
369  rv = geometry_type_from_string(str, &type, &z, &m);
370  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
371  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
372  CU_ASSERT_EQUAL(type, LINETYPE);
373  CU_ASSERT_EQUAL(z, 0);
374  CU_ASSERT_EQUAL(m, 1);
375 
376  str = "MULTIPOLYGONZM";
377  rv = geometry_type_from_string(str, &type, &z, &m);
378  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
379  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
380  CU_ASSERT_EQUAL(type, MULTIPOLYGONTYPE);
381  CU_ASSERT_EQUAL(z, 1);
382  CU_ASSERT_EQUAL(m, 1);
383 
384  str = " GEOMETRYCOLLECTIONZM ";
385  rv = geometry_type_from_string(str, &type, &z, &m);
386  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
387  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
388  CU_ASSERT_EQUAL(type, COLLECTIONTYPE);
389  CU_ASSERT_EQUAL(z, 1);
390  CU_ASSERT_EQUAL(m, 1);
391 
392  str = " GEOMERYCOLLECTIONZM ";
393  rv = geometry_type_from_string(str, &type, &z, &m);
394  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
395  CU_ASSERT_EQUAL(rv, LW_FAILURE);
396 
397 }
#define LINETYPE
Definition: liblwgeom.h:61
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Calculate type integer and dimensional flags from string input.
Definition: g_util.c:149
#define LW_SUCCESS
Definition: liblwgeom.h:55
#define LW_FAILURE
Definition: liblwgeom.h:54
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: