PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_geometry_type_from_string()

static void test_geometry_type_from_string ( void  )
static

Definition at line 342 of file cu_gserialized1.c.

343 {
344  int rv;
345  uint8_t type = 0;
346  int z = 0, m = 0;
347  char *str;
348 
349  str = " POINTZ";
350  rv = geometry_type_from_string(str, &type, &z, &m);
351  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
352  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
353  CU_ASSERT_EQUAL(type, POINTTYPE);
354  CU_ASSERT_EQUAL(z, 1);
355  CU_ASSERT_EQUAL(m, 0);
356 
357  str = "LINESTRINGM ";
358  rv = geometry_type_from_string(str, &type, &z, &m);
359  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
360  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
361  CU_ASSERT_EQUAL(type, LINETYPE);
362  CU_ASSERT_EQUAL(z, 0);
363  CU_ASSERT_EQUAL(m, 1);
364 
365  str = "MULTIPOLYGONZM";
366  rv = geometry_type_from_string(str, &type, &z, &m);
367  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
368  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
369  CU_ASSERT_EQUAL(type, MULTIPOLYGONTYPE);
370  CU_ASSERT_EQUAL(z, 1);
371  CU_ASSERT_EQUAL(m, 1);
372 
373  str = " GEOMETRYCOLLECTIONZM ";
374  rv = geometry_type_from_string(str, &type, &z, &m);
375  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
376  CU_ASSERT_EQUAL(rv, LW_SUCCESS);
377  CU_ASSERT_EQUAL(type, COLLECTIONTYPE);
378  CU_ASSERT_EQUAL(z, 1);
379  CU_ASSERT_EQUAL(m, 1);
380 
381  str = " GEOMERYCOLLECTIONZM ";
382  rv = geometry_type_from_string(str, &type, &z, &m);
383  //printf("\n in type: %s\nout type: %d\n out z: %d\n out m: %d", str, type, z, m);
384  CU_ASSERT_EQUAL(rv, LW_FAILURE);
385 
386 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define LW_FAILURE
Definition: liblwgeom.h:110
#define LINETYPE
Definition: liblwgeom.h:117
#define LW_SUCCESS
Definition: liblwgeom.h:111
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Utility function to get type number from string.
Definition: lwutil.c:489
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:121
#define str(s)
type
Definition: ovdump.py:42

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

Referenced by gserialized1_suite_setup().

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