mirror of
https://github.com/yshui/picom.git
synced 2024-11-25 14:06:08 -05:00
test.h: update to upstream 368c467
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
cb0b846dbe
commit
e757a6461d
1 changed files with 16 additions and 0 deletions
|
@ -78,6 +78,18 @@ struct test_file_metadata __attribute__((weak)) * test_file_head;
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define TEST_STRNEQUAL(a, b, len) \
|
||||||
|
do { \
|
||||||
|
if (strncmp(a, b, len) != 0) { \
|
||||||
|
const char *part2 = " != " #b; \
|
||||||
|
size_t len2 = len + strlen(part2) + 3; \
|
||||||
|
char *buf = malloc(len2); \
|
||||||
|
snprintf(buf, len2, "\"%.*s\"%s", len, a, part2); \
|
||||||
|
SET_FAILURE(buf, true); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define TEST_CASE(_name) \
|
#define TEST_CASE(_name) \
|
||||||
static void __test_h_##_name(struct test_case_metadata *, \
|
static void __test_h_##_name(struct test_case_metadata *, \
|
||||||
struct test_file_metadata *); \
|
struct test_file_metadata *); \
|
||||||
|
@ -191,5 +203,9 @@ static inline void __attribute__((constructor(102))) run_tests(void) {
|
||||||
#define TEST_STREQUAL(a, b) \
|
#define TEST_STREQUAL(a, b) \
|
||||||
(void)(a); \
|
(void)(a); \
|
||||||
(void)(b)
|
(void)(b)
|
||||||
|
#define TEST_STRNEQUAL(a, b, len) \
|
||||||
|
(void)(a); \
|
||||||
|
(void)(b); \
|
||||||
|
(void)(len)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue