34 #ifndef D_TestHarness_c_h
35 #define D_TestHarness_c_h
37 #include "CppUTestConfig.h"
39 #define CHECK_EQUAL_C_INT(expected,actual) \
40 CHECK_EQUAL_C_INT_LOCATION(expected,actual,__FILE__,__LINE__)
42 #define CHECK_EQUAL_C_REAL(expected,actual,threshold) \
43 CHECK_EQUAL_C_REAL_LOCATION(expected,actual,threshold,__FILE__,__LINE__)
45 #define CHECK_EQUAL_C_CHAR(expected,actual) \
46 CHECK_EQUAL_C_CHAR_LOCATION(expected,actual,__FILE__,__LINE__)
48 #define CHECK_EQUAL_C_STRING(expected,actual) \
49 CHECK_EQUAL_C_STRING_LOCATION(expected,actual,__FILE__,__LINE__)
51 #define FAIL_TEXT_C(text) \
52 FAIL_TEXT_C_LOCATION(text,__FILE__,__LINE__)
55 FAIL_C_LOCATION(__FILE__,__LINE__)
57 #define CHECK_C(condition) \
58 CHECK_C_LOCATION(condition, #condition, __FILE__,__LINE__)
67 extern void CHECK_EQUAL_C_INT_LOCATION(
int expected,
int actual,
68 const char* fileName,
int lineNumber);
69 extern void CHECK_EQUAL_C_REAL_LOCATION(
double expected,
double actual,
70 double threshold,
const char* fileName,
int lineNumber);
71 extern void CHECK_EQUAL_C_CHAR_LOCATION(
char expected,
char actual,
72 const char* fileName,
int lineNumber);
73 extern void CHECK_EQUAL_C_STRING_LOCATION(
const char* expected,
74 const char* actual,
const char* fileName,
int lineNumber);
75 extern void FAIL_TEXT_C_LOCATION(
const char* text,
const char* fileName,
77 extern void FAIL_C_LOCATION(
const char* fileName,
int lineNumber);
78 extern void CHECK_C_LOCATION(
int condition,
const char* conditionString,
79 const char* fileName,
int lineNumber);
81 extern void* cpputest_malloc(
size_t size);
82 extern void* cpputest_calloc(
size_t num,
size_t size);
83 extern void* cpputest_realloc(
void* ptr,
size_t size);
84 extern void cpputest_free(
void* buffer);
86 extern void* cpputest_malloc_location(
size_t size,
const char* file,
int line);
87 extern void* cpputest_calloc_location(
size_t num,
size_t size,
88 const char* file,
int line);
89 extern void* cpputest_realloc_location(
void* memory,
size_t size,
90 const char* file,
int line);
91 extern void cpputest_free_location(
void* buffer,
const char* file,
int line);
93 void cpputest_malloc_set_out_of_memory(
void);
94 void cpputest_malloc_set_not_out_of_memory(
void);
95 void cpputest_malloc_set_out_of_memory_countdown(
int);
96 void cpputest_malloc_count_reset(
void);
97 int cpputest_malloc_get_count(
void);
110 #if defined(__GNUC__)
111 # define PUNUSED(x) PUNUSED_ ##x __attribute__((unused))
113 # define PUNUSED(x) x