36 #ifndef AUNIT_ASSERTION_H 37 #define AUNIT_ASSERTION_H 42 #define assertEqual(arg1,arg2) assertOp(arg1,aunit::compareEqual,"==",arg2) 45 #define assertNotEqual(arg1,arg2) \ 46 assertOp(arg1,aunit::compareNotEqual,"!=",arg2) 49 #define assertLess(arg1,arg2) assertOp(arg1,aunit::compareLess,"<",arg2) 52 #define assertMore(arg1,arg2) assertOp(arg1,aunit::compareMore,">",arg2) 55 #define assertLessOrEqual(arg1,arg2) \ 56 assertOp(arg1,aunit::compareLessOrEqual,"<=",arg2) 59 #define assertMoreOrEqual(arg1,arg2) \ 60 assertOp(arg1,aunit::compareMoreOrEqual,">=",arg2) 63 #define assertTrue(arg) assertEqual(arg,true) 66 #define assertFalse(arg) assertEqual(arg,false) 69 #define assertOp(arg1,op,opName,arg2) do {\ 70 if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\ 74 class __FlashStringHelper;
115 bool assertion(
const char* file, uint16_t line,
bool lhs,
116 const char* opName,
bool (*op)(
bool lhs,
bool rhs),
119 bool assertion(
const char* file, uint16_t line,
char lhs,
120 const char* opName,
bool (*op)(
char lhs,
char rhs),
123 bool assertion(
const char* file, uint16_t line,
int lhs,
124 const char* opName,
bool (*op)(
int lhs,
int rhs),
127 bool assertion(
const char* file, uint16_t line,
unsigned int lhs,
128 const char* opName,
bool (*op)(
unsigned int lhs,
unsigned int rhs),
131 bool assertion(
const char* file, uint16_t line,
long lhs,
132 const char* opName,
bool (*op)(
long lhs,
long rhs),
135 bool assertion(
const char* file, uint16_t line,
unsigned long lhs,
136 const char* opName,
bool (*op)(
unsigned long lhs,
unsigned long rhs),
139 bool assertion(
const char* file, uint16_t line,
double lhs,
140 const char* opName,
bool (*op)(
double lhs,
double rhs),
143 bool assertion(
const char* file, uint16_t line,
const char* lhs,
144 const char* opName,
bool (*op)(
const char* lhs,
const char* rhs),
147 bool assertion(
const char* file, uint16_t line,
const char* lhs,
148 const char *opName,
bool (*op)(
const char* lhs,
const String& rhs),
151 bool assertion(
const char* file, uint16_t line,
const char* lhs,
153 bool (*op)(
const char* lhs,
const __FlashStringHelper* rhs),
154 const __FlashStringHelper* rhs);
156 bool assertion(
const char* file, uint16_t line,
const String& lhs,
157 const char *opName,
bool (*op)(
const String& lhs,
const char* rhs),
160 bool assertion(
const char* file, uint16_t line,
const String& lhs,
161 const char *opName,
bool (*op)(
const String& lhs,
const String& rhs),
164 bool assertion(
const char* file, uint16_t line,
const String& lhs,
166 bool (*op)(
const String& lhs,
const __FlashStringHelper* rhs),
167 const __FlashStringHelper* rhs);
169 bool assertion(
const char* file, uint16_t line,
170 const __FlashStringHelper* lhs,
const char *opName,
171 bool (*op)(
const __FlashStringHelper* lhs,
const char* rhs),
174 bool assertion(
const char* file, uint16_t line,
175 const __FlashStringHelper* lhs,
const char *opName,
176 bool (*op)(
const __FlashStringHelper* lhs,
const String& rhs),
179 bool assertion(
const char* file, uint16_t line,
180 const __FlashStringHelper* lhs,
const char *opName,
181 bool (*op)(
const __FlashStringHelper* lhs,
182 const __FlashStringHelper* rhs),
183 const __FlashStringHelper* rhs);
Base class of all test cases.
bool isOutputEnabled(bool ok)
Returns true if an assertion message should be printed.
An Assertion class is a subclass of Test and provides various overloaded assertion() functions...
Assertion()
Empty constructor.