AUnit  0.5.2
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Macros
AssertMacros.h File Reference

Various assertion macros (assertXxx()) are defined in this header. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define assertEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2. More...
 
#define assertNotEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2. More...
 
#define assertLess(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2. More...
 
#define assertMore(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2. More...
 
#define assertLessOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2. More...
 
#define assertMoreOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2. More...
 
#define assertTrue(arg)   assertBoolInternal(arg,true)
 Assert that arg is true. More...
 
#define assertFalse(arg)   assertBoolInternal(arg,false)
 Assert that arg is false. More...
 
#define assertOpInternal(arg1, op, opName, arg2)
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertBoolInternal(arg, value)
 Internal helper macro, shouldn't be called directly by users. More...
 

Detailed Description

Various assertion macros (assertXxx()) are defined in this header.

These macros can be used only in a subclass of TestOnce or TestAgain, which is true for all tests created by test(), testing(), testF() and testingF().

Definition in file AssertMacros.h.

Macro Definition Documentation

◆ assertBoolInternal

#define assertBoolInternal (   arg,
  value 
)
Value:
do {\
if (!assertionBool(__FILE__,__LINE__,(arg),(value)))\
return;\
} while (false)

Internal helper macro, shouldn't be called directly by users.

Definition at line 76 of file AssertMacros.h.

◆ assertEqual

#define assertEqual (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)

Assert that arg1 is equal to arg2.

Definition at line 40 of file AssertMacros.h.

◆ assertFalse

#define assertFalse (   arg)    assertBoolInternal(arg,false)

Assert that arg is false.

Definition at line 67 of file AssertMacros.h.

◆ assertLess

#define assertLess (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)

Assert that arg1 is less than arg2.

Definition at line 48 of file AssertMacros.h.

◆ assertLessOrEqual

#define assertLessOrEqual (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)

Assert that arg1 is less than or equal to arg2.

Definition at line 56 of file AssertMacros.h.

◆ assertMore

#define assertMore (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)

Assert that arg1 is more than arg2.

Definition at line 52 of file AssertMacros.h.

◆ assertMoreOrEqual

#define assertMoreOrEqual (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)

Assert that arg1 is more than or equal to arg2.

Definition at line 60 of file AssertMacros.h.

◆ assertNotEqual

#define assertNotEqual (   arg1,
  arg2 
)    assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)

Assert that arg1 is not equal to arg2.

Definition at line 44 of file AssertMacros.h.

◆ assertOpInternal

#define assertOpInternal (   arg1,
  op,
  opName,
  arg2 
)
Value:
do {\
if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\
return;\
} while (false)

Internal helper macro, shouldn't be called directly by users.

Definition at line 70 of file AssertMacros.h.

◆ assertTrue

#define assertTrue (   arg)    assertBoolInternal(arg,true)

Assert that arg is true.

Definition at line 64 of file AssertMacros.h.