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

Definition at line 66 of file cu_libgeom.c.

References FLAGS_GET_BBOX, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_READONLY, FLAGS_GET_Z, FLAGS_GET_ZM, FLAGS_SET_BBOX, FLAGS_SET_GEODETIC, FLAGS_SET_M, FLAGS_SET_READONLY, FLAGS_SET_Z, and gflags().

Referenced by libgeom_suite_setup().

67 {
68  uint8_t flags = 0;
69 
70  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
71  FLAGS_SET_Z(flags, 1);
72  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
73  FLAGS_SET_Z(flags, 0);
74  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
75  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
76 
77  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
78  FLAGS_SET_M(flags, 1);
79  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
80 
81  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
82  FLAGS_SET_BBOX(flags, 1);
83  CU_ASSERT_EQUAL(1, FLAGS_GET_BBOX(flags));
84  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
85 
86  FLAGS_SET_READONLY(flags, 1);
87  CU_ASSERT_EQUAL(1, FLAGS_GET_READONLY(flags));
88  FLAGS_SET_READONLY(flags, 0);
89  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
90 
91  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
92  FLAGS_SET_GEODETIC(flags, 1);
93  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
94 
95  flags = gflags(1, 0, 1); /* z=1, m=0, geodetic=1 */
96 
97  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
98  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
99  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
100  CU_ASSERT_EQUAL(2, FLAGS_GET_ZM(flags));
101 
102  flags = gflags(1, 1, 1); /* z=1, m=1, geodetic=1 */
103 
104  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
105  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
106  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
107  CU_ASSERT_EQUAL(3, FLAGS_GET_ZM(flags));
108 
109  flags = gflags(0, 1, 0); /* z=0, m=1, geodetic=0 */
110 
111  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
112  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
113  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
114  CU_ASSERT_EQUAL(1, FLAGS_GET_ZM(flags));
115 }
#define FLAGS_GET_READONLY(flags)
Definition: liblwgeom.h:110
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:109
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:119
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:115
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:112
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:108
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:131
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:114
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:116
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:113

Here is the call graph for this function:

Here is the caller graph for this function: