X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Funit%2Fust-utils%2Fust-utils-common.h;h=0dd15d1975dcfcb8bb3448764c66b959f45cda15;hb=62eb004ccbd4b3d759bda96f7a0c6d072b23ffa9;hp=0792a10e2f9d97c8d1655b6d805c8a4dbdd638a6;hpb=2ebb27909ba460be6b58e24750e1cd55b12729df;p=lttng-ust.git diff --git a/tests/unit/ust-utils/ust-utils-common.h b/tests/unit/ust-utils/ust-utils-common.h index 0792a10e..0dd15d19 100644 --- a/tests/unit/ust-utils/ust-utils-common.h +++ b/tests/unit/ust-utils/ust-utils-common.h @@ -6,7 +6,7 @@ #include "tap.h" -#define NUM_TESTS 60 +#define NUM_TESTS 94 static void test_ust_stringify(void) @@ -116,6 +116,61 @@ void test_ust_is_integer_type(void) ok_is_not_integer_type(void *); } +#define ok_is_pointer_type(_type) \ + ok(lttng_ust_is_pointer_type(_type) == true, "lttng_ust_is_pointer_type - '" lttng_ust_stringify(_type) "' is a pointer") + +#define ok_is_not_pointer_type(_type) \ + ok(lttng_ust_is_pointer_type(_type) == false, "lttng_ust_is_pointer_type - '" lttng_ust_stringify(_type) "' is not a pointer") + +struct dummy { + int a; +}; + +static +void test_ust_is_pointer_type(void) +{ + ok_is_not_pointer_type(char); + ok_is_not_pointer_type(short); + ok_is_not_pointer_type(int); + ok_is_not_pointer_type(long); + ok_is_not_pointer_type(long long); + + ok_is_not_pointer_type(signed char); + ok_is_not_pointer_type(signed short); + ok_is_not_pointer_type(signed int); + ok_is_not_pointer_type(signed long); + ok_is_not_pointer_type(signed long long); + + ok_is_not_pointer_type(unsigned char); + ok_is_not_pointer_type(unsigned short); + ok_is_not_pointer_type(unsigned int); + ok_is_not_pointer_type(unsigned long); + ok_is_not_pointer_type(unsigned long long); + + ok_is_not_pointer_type(int8_t); + ok_is_not_pointer_type(int16_t); + ok_is_not_pointer_type(int32_t); + ok_is_not_pointer_type(int64_t); + ok_is_not_pointer_type(intmax_t); + + ok_is_not_pointer_type(uint8_t); + ok_is_not_pointer_type(uint16_t); + ok_is_not_pointer_type(uint32_t); + ok_is_not_pointer_type(uint64_t); + ok_is_not_pointer_type(uintmax_t); + + ok_is_not_pointer_type(float); + ok_is_not_pointer_type(double); + ok_is_not_pointer_type(long double); + + ok_is_pointer_type(void *); + ok_is_pointer_type(void **); + ok_is_pointer_type(struct dummy *); + ok_is_pointer_type(int *); + ok_is_pointer_type(float *); + ok_is_pointer_type(double *); +} + int main(void) { plan_tests(NUM_TESTS); @@ -123,6 +178,7 @@ int main(void) test_ust_stringify(); test_ust_is_signed(); test_ust_is_integer_type(); + test_ust_is_pointer_type(); return exit_status(); }