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

Definition at line 75 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().

76 {
77  uint8_t flags = 0;
78 
79  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
80  FLAGS_SET_Z(flags, 1);
81  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
82  FLAGS_SET_Z(flags, 0);
83  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
84  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
85 
86  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
87  FLAGS_SET_M(flags, 1);
88  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
89 
90  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
91  FLAGS_SET_BBOX(flags, 1);
92  CU_ASSERT_EQUAL(1, FLAGS_GET_BBOX(flags));
93  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
94 
95  FLAGS_SET_READONLY(flags, 1);
96  CU_ASSERT_EQUAL(1, FLAGS_GET_READONLY(flags));
97  FLAGS_SET_READONLY(flags, 0);
98  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
99 
100  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
101  FLAGS_SET_GEODETIC(flags, 1);
102  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
103 
104  flags = gflags(1, 0, 1); /* z=1, m=0, geodetic=1 */
105 
106  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
107  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
108  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
109  CU_ASSERT_EQUAL(2, FLAGS_GET_ZM(flags));
110 
111  flags = gflags(1, 1, 1); /* z=1, m=1, geodetic=1 */
112 
113  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
114  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
115  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
116  CU_ASSERT_EQUAL(3, FLAGS_GET_ZM(flags));
117 
118  flags = gflags(0, 1, 0); /* z=0, m=1, geodetic=0 */
119 
120  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
121  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
122  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
123  CU_ASSERT_EQUAL(1, FLAGS_GET_ZM(flags));
124 }
#define FLAGS_GET_READONLY(flags)
Definition: liblwgeom.h:128
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:127
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:137
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:133
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:130
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:126
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:132
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:134
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:131

Here is the call graph for this function:

Here is the caller graph for this function: