AUnit  0.4.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Classes | Macros
Assertion.h File Reference

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

#include "Test.h"
Include dependency graph for Assertion.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  aunit::Assertion
 An Assertion class is a subclass of Test and provides various overloaded assertion() functions. More...
 

Macros

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

Detailed Description

Various assertXxx() macros are defined in this header.

They all go through another helper macro called assertOp(), eventually calling one of the methods on the Assertion class.

Definition in file Assertion.h.

Macro Definition Documentation

◆ assertEqual

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

Assert that arg1 is equal to arg2.

Definition at line 42 of file Assertion.h.

◆ assertFalse

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

Assert that arg is false.

Definition at line 66 of file Assertion.h.

◆ assertLess

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

Assert that arg1 is less than arg2.

Definition at line 49 of file Assertion.h.

◆ assertLessOrEqual

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

Assert that arg1 is less than or equal to arg2.

Definition at line 55 of file Assertion.h.

◆ assertMore

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

Assert that arg1 is more than arg2.

Definition at line 52 of file Assertion.h.

◆ assertMoreOrEqual

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

Assert that arg1 is more than or equal to arg2.

Definition at line 59 of file Assertion.h.

◆ assertNotEqual

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

Assert that arg1 is not equal to arg2.

Definition at line 45 of file Assertion.h.

◆ assertOp

#define assertOp (   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 69 of file Assertion.h.

◆ assertTrue

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

Assert that arg is true.

Definition at line 63 of file Assertion.h.