2 * SPDX-License-Identifier: LGPL-2.1-or-later
4 * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
12 void test_ust_stringify(void)
14 ok(strcmp(lttng_ust_stringify(1), "1") == 0, "lttng_ust_stringify - literal integer");
15 ok(strcmp(lttng_ust_stringify(random_identifier
), "random_identifier") == 0, "lttng_ust_stringify - identifier");
18 #define ok_is_signed(_type) \
19 ok(lttng_ust_is_signed_type(_type) == true, "lttng_ust_is_signed_type - '" lttng_ust_stringify(_type) "' is signed")
21 #define ok_is_unsigned(_type) \
22 ok(lttng_ust_is_signed_type(_type) == false, "lttng_ust_is_signed_type - '" lttng_ust_stringify(_type) "' is unsigned")
25 void test_ust_is_signed(void)
31 ok_is_signed(signed char);
35 ok_is_signed(long long);
38 ok_is_signed(long double);
41 ok_is_signed(int16_t);
42 ok_is_signed(int32_t);
43 ok_is_signed(int64_t);
44 ok_is_signed(intmax_t);
46 ok_is_signed(ssize_t
);
47 ok_is_signed(ptrdiff_t);
48 ok_is_signed(intptr_t);
54 ok_is_unsigned(unsigned char);
55 ok_is_unsigned(unsigned short);
56 ok_is_unsigned(unsigned int);
57 ok_is_unsigned(unsigned long);
58 ok_is_unsigned(unsigned long long);
60 ok_is_unsigned(uint8_t);
61 ok_is_unsigned(uint16_t);
62 ok_is_unsigned(uint32_t);
63 ok_is_unsigned(uint64_t);
64 ok_is_unsigned(uintmax_t);
67 ok_is_unsigned(size_t);
69 ok_is_unsigned(void *);
73 #define ok_is_integer_type(_type) \
74 ok(lttng_ust_is_integer_type(_type) == true, "lttng_ust_is_integer_type - '" lttng_ust_stringify(_type) "' is an integer")
76 #define ok_is_not_integer_type(_type) \
77 ok(lttng_ust_is_integer_type(_type) == false, "lttng_ust_is_integer_type - '" lttng_ust_stringify(_type) "' is not an integer")
80 void test_ust_is_integer_type(void)
82 ok_is_integer_type(char);
83 ok_is_integer_type(short);
84 ok_is_integer_type(int);
85 ok_is_integer_type(long);
86 ok_is_integer_type(long long);
88 ok_is_integer_type(signed char);
89 ok_is_integer_type(signed short);
90 ok_is_integer_type(signed int);
91 ok_is_integer_type(signed long);
92 ok_is_integer_type(signed long long);
94 ok_is_integer_type(unsigned char);
95 ok_is_integer_type(unsigned short);
96 ok_is_integer_type(unsigned int);
97 ok_is_integer_type(unsigned long);
98 ok_is_integer_type(unsigned long long);
100 ok_is_integer_type(int8_t);
101 ok_is_integer_type(int16_t);
102 ok_is_integer_type(int32_t);
103 ok_is_integer_type(int64_t);
104 ok_is_integer_type(intmax_t);
106 ok_is_integer_type(uint8_t);
107 ok_is_integer_type(uint16_t);
108 ok_is_integer_type(uint32_t);
109 ok_is_integer_type(uint64_t);
110 ok_is_integer_type(uintmax_t);
112 ok_is_not_integer_type(float);
113 ok_is_not_integer_type(double);
114 ok_is_not_integer_type(long double);
116 ok_is_not_integer_type(void *);
119 #define ok_is_pointer_type(_type) \
120 ok(lttng_ust_is_pointer_type(_type) == true, "lttng_ust_is_pointer_type - '" lttng_ust_stringify(_type) "' is a pointer")
122 #define ok_is_not_pointer_type(_type) \
123 ok(lttng_ust_is_pointer_type(_type) == false, "lttng_ust_is_pointer_type - '" lttng_ust_stringify(_type) "' is not a pointer")
130 void test_ust_is_pointer_type(void)
132 ok_is_not_pointer_type(char);
133 ok_is_not_pointer_type(short);
134 ok_is_not_pointer_type(int);
135 ok_is_not_pointer_type(long);
136 ok_is_not_pointer_type(long long);
138 ok_is_not_pointer_type(signed char);
139 ok_is_not_pointer_type(signed short);
140 ok_is_not_pointer_type(signed int);
141 ok_is_not_pointer_type(signed long);
142 ok_is_not_pointer_type(signed long long);
144 ok_is_not_pointer_type(unsigned char);
145 ok_is_not_pointer_type(unsigned short);
146 ok_is_not_pointer_type(unsigned int);
147 ok_is_not_pointer_type(unsigned long);
148 ok_is_not_pointer_type(unsigned long long);
150 ok_is_not_pointer_type(int8_t);
151 ok_is_not_pointer_type(int16_t);
152 ok_is_not_pointer_type(int32_t);
153 ok_is_not_pointer_type(int64_t);
154 ok_is_not_pointer_type(intmax_t);
156 ok_is_not_pointer_type(uint8_t);
157 ok_is_not_pointer_type(uint16_t);
158 ok_is_not_pointer_type(uint32_t);
159 ok_is_not_pointer_type(uint64_t);
160 ok_is_not_pointer_type(uintmax_t);
162 ok_is_not_pointer_type(float);
163 ok_is_not_pointer_type(double);
164 ok_is_not_pointer_type(long double);
166 ok_is_pointer_type(void *);
167 ok_is_pointer_type(void **);
168 ok_is_pointer_type(struct dummy
*);
169 ok_is_pointer_type(int *);
170 ok_is_pointer_type(float *);
171 ok_is_pointer_type(double *);
176 plan_tests(NUM_TESTS
);
178 test_ust_stringify();
179 test_ust_is_signed();
180 test_ust_is_integer_type();
181 test_ust_is_pointer_type();
183 return exit_status();
This page took 0.033007 seconds and 4 git commands to generate.