PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ test_flags_macros()

static void test_flags_macros ( void  )
static

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

77 {
78  uint8_t flags = 0;
79 
80  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
81  FLAGS_SET_Z(flags, 1);
82  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
83  FLAGS_SET_Z(flags, 0);
84  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
85  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
86 
87  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
88  FLAGS_SET_M(flags, 1);
89  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
90 
91  CU_ASSERT_EQUAL(0, FLAGS_GET_BBOX(flags));
92  FLAGS_SET_BBOX(flags, 1);
93  CU_ASSERT_EQUAL(1, FLAGS_GET_BBOX(flags));
94  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
95 
96  FLAGS_SET_READONLY(flags, 1);
97  CU_ASSERT_EQUAL(1, FLAGS_GET_READONLY(flags));
98  FLAGS_SET_READONLY(flags, 0);
99  CU_ASSERT_EQUAL(0, FLAGS_GET_READONLY(flags));
100 
101  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
102  FLAGS_SET_GEODETIC(flags, 1);
103  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
104 
105  flags = gflags(1, 0, 1); /* z=1, m=0, geodetic=1 */
106 
107  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
108  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
109  CU_ASSERT_EQUAL(0, FLAGS_GET_M(flags));
110  CU_ASSERT_EQUAL(2, FLAGS_GET_ZM(flags));
111 
112  flags = gflags(1, 1, 1); /* z=1, m=1, geodetic=1 */
113 
114  CU_ASSERT_EQUAL(1, FLAGS_GET_GEODETIC(flags));
115  CU_ASSERT_EQUAL(1, FLAGS_GET_Z(flags));
116  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
117  CU_ASSERT_EQUAL(3, FLAGS_GET_ZM(flags));
118 
119  flags = gflags(0, 1, 0); /* z=0, m=1, geodetic=0 */
120 
121  CU_ASSERT_EQUAL(0, FLAGS_GET_GEODETIC(flags));
122  CU_ASSERT_EQUAL(0, FLAGS_GET_Z(flags));
123  CU_ASSERT_EQUAL(1, FLAGS_GET_M(flags));
124  CU_ASSERT_EQUAL(1, FLAGS_GET_ZM(flags));
125 }
#define FLAGS_GET_READONLY(flags)
Definition: liblwgeom.h:143
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:142
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:148
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:145
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:141
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:147
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
unsigned char uint8_t
Definition: uthash.h:79
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:149
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:146
Here is the call graph for this function:
Here is the caller graph for this function: