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 *);
121 plan_tests(NUM_TESTS
);
123 test_ust_stringify();
124 test_ust_is_signed();
125 test_ust_is_integer_type();
127 return exit_status();
This page took 0.049907 seconds and 4 git commands to generate.