blob: 33231909774dcc9443af9444550e9492bd5aece8 (
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
26
27
28
29
|
#pragma once
#include <stdio.h>
#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);
|