blob: 7ab481629dacca68423fc03f627c45501fe392ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#define TEST(name) testfn__ ## name
// Test function should return 0 on success, nonzero value on error
#ifdef TEST_HEADER_GENERATION
#define DEFINE_TEST(name) XXTEST_DECLARATION(TEST(name))
#else
#define DEFINE_TEST(name) int TEST(name)(void)
#endif
void test_report_error(
const char *type, const char *condition, const char *fname, int lineno);
#define EXPECT(cond_) do { \
if (!(cond_)) test_report_error("EXPECT", #cond_, __FILE__, __LINE__); \
} while (0)
#define EXPECTRET(cond_, ret_) do { \
if (!(cond_)) { \
test_report_error("EXPECT", #cond_, __FILE__, __LINE__); \
return (ret_); \
} \
}
|