#pragma once #include #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(ret_, cond_) do { \ if (!(cond_)) { \ test_report_error("EXPECT", #cond_, __FILE__, __LINE__); \ return (ret_); \ } \ } while (0) void print_buffer(FILE *stream, const void *buffer, size_t length);