34 #ifndef AUNIT_ASSERTION_H 35 #define AUNIT_ASSERTION_H 39 #include "Verbosity.h" 40 #include "TestRunner.h" 45 #define assertEqual(arg1,arg2) assertOp(arg1,aunit::compareEqual,"==",arg2) 48 #define assertNotEqual(arg1,arg2) \ 49 assertOp(arg1,aunit::compareNotEqual,"!=",arg2) 52 #define assertLess(arg1,arg2) assertOp(arg1,aunit::compareLess,"<",arg2) 55 #define assertMore(arg1,arg2) assertOp(arg1,aunit::compareMore,">",arg2) 58 #define assertLessOrEqual(arg1,arg2) \ 59 assertOp(arg1,aunit::compareLessOrEqual,"<=",arg2) 62 #define assertMoreOrEqual(arg1,arg2) \ 63 assertOp(arg1,aunit::compareMoreOrEqual,">=",arg2) 66 #define assertTrue(arg) assertEqual(arg,true) 69 #define assertFalse(arg) assertEqual(arg,false) 72 #define assertOp(arg1,op,opName,arg2) do {\ 73 if (!aunit::assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\ 87 bool assertion(
const char* file, uint16_t line,
bool lhs,
88 const char* opName,
bool (*op)(
bool lhs,
bool rhs),
91 bool assertion(
const char* file, uint16_t line,
char lhs,
92 const char* opName,
bool (*op)(
char lhs,
char rhs),
95 bool assertion(
const char* file, uint16_t line,
int lhs,
96 const char* opName,
bool (*op)(
int lhs,
int rhs),
99 bool assertion(
const char* file, uint16_t line,
unsigned int lhs,
100 const char* opName,
bool (*op)(
unsigned int lhs,
unsigned int rhs),
103 bool assertion(
const char* file, uint16_t line,
long lhs,
104 const char* opName,
bool (*op)(
long lhs,
long rhs),
107 bool assertion(
const char* file, uint16_t line,
unsigned long lhs,
108 const char* opName,
bool (*op)(
unsigned long lhs,
unsigned long rhs),
111 bool assertion(
const char* file, uint16_t line,
double lhs,
112 const char* opName,
bool (*op)(
double lhs,
double rhs),
115 bool assertion(
const char* file, uint16_t line,
const char* lhs,
116 const char* opName,
bool (*op)(
const char* lhs,
const char* rhs),
119 bool assertion(
const char* file, uint16_t line,
const char* lhs,
120 const char *opName,
bool (*op)(
const char* lhs,
const String& rhs),
123 bool assertion(
const char* file, uint16_t line,
const char* lhs,
125 bool (*op)(
const char* lhs,
const __FlashStringHelper* rhs),
126 const __FlashStringHelper* rhs);
128 bool assertion(
const char* file, uint16_t line,
const String& lhs,
129 const char *opName,
bool (*op)(
const String& lhs,
const char* rhs),
132 bool assertion(
const char* file, uint16_t line,
const String& lhs,
133 const char *opName,
bool (*op)(
const String& lhs,
const String& rhs),
136 bool assertion(
const char* file, uint16_t line,
const String& lhs,
138 bool (*op)(
const String& lhs,
const __FlashStringHelper* rhs),
139 const __FlashStringHelper* rhs);
141 bool assertion(
const char* file, uint16_t line,
142 const __FlashStringHelper* lhs,
const char *opName,
143 bool (*op)(
const __FlashStringHelper* lhs,
const char* rhs),
146 bool assertion(
const char* file, uint16_t line,
147 const __FlashStringHelper* lhs,
const char *opName,
148 bool (*op)(
const __FlashStringHelper* lhs,
const String& rhs),
151 bool assertion(
const char* file, uint16_t line,
152 const __FlashStringHelper* lhs,
const char *opName,
153 bool (*op)(
const __FlashStringHelper* lhs,
const __FlashStringHelper* rhs),
154 const __FlashStringHelper* rhs);