PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ test_geometry_type_from_string()

static void test_geometry_type_from_string ( void  )
static

Definition at line 361 of file cu_libgeom.c.

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

Referenced by libgeom_suite_setup().

362 {
363  int rv;
364  uint8_t type = 0;
365  int z = 0, m = 0;
366  char *str;
367 
368  str = " POINTZ";
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, POINTTYPE);
373  CU_ASSERT_EQUAL(z, 1);
374  CU_ASSERT_EQUAL(m, 0);
375 
376  str = "LINESTRINGM ";
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, LINETYPE);
381  CU_ASSERT_EQUAL(z, 0);
382  CU_ASSERT_EQUAL(m, 1);
383 
384  str = "MULTIPOLYGONZM";
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, MULTIPOLYGONTYPE);
389  CU_ASSERT_EQUAL(z, 1);
390  CU_ASSERT_EQUAL(m, 1);
391 
392  str = " GEOMETRYCOLLECTIONZM ";
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_SUCCESS);
396  CU_ASSERT_EQUAL(type, COLLECTIONTYPE);
397  CU_ASSERT_EQUAL(z, 1);
398  CU_ASSERT_EQUAL(m, 1);
399 
400  str = " GEOMERYCOLLECTIONZM ";
401  rv = geometry_type_from_string(str, &type, &z, &m);
402  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
403  CU_ASSERT_EQUAL(rv, LW_FAILURE);
404 
405 }
#define LINETYPE
Definition: liblwgeom.h:71
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:148
#define LW_SUCCESS
Definition: liblwgeom.h:65
#define LW_FAILURE
Definition: liblwgeom.h:64
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
type
Definition: ovdump.py:41
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: