AUnit  0.3.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit.
Macros | Functions
Assertion.h File Reference

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

#include <Arduino.h>
#include "Printer.h"
#include "Verbosity.h"
#include "TestRunner.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.

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...
 

Functions

bool aunit::assertion (const char *file, uint16_t line, bool lhs, const char *opName, bool(*op)(bool lhs, bool rhs), bool rhs)
 
bool aunit::assertion (const char *file, uint16_t line, char lhs, const char *opName, bool(*op)(char lhs, char rhs), char rhs)
 
bool aunit::assertion (const char *file, uint16_t line, int lhs, const char *opName, bool(*op)(int lhs, int rhs), int rhs)
 
bool aunit::assertion (const char *file, uint16_t line, unsigned int lhs, const char *opName, bool(*op)(unsigned int lhs, unsigned int rhs), unsigned int rhs)
 
bool aunit::assertion (const char *file, uint16_t line, long lhs, const char *opName, bool(*op)(long lhs, long rhs), long rhs)
 
bool aunit::assertion (const char *file, uint16_t line, unsigned long lhs, const char *opName, bool(*op)(unsigned long lhs, unsigned long rhs), unsigned long rhs)
 
bool aunit::assertion (const char *file, uint16_t line, double lhs, const char *opName, bool(*op)(double lhs, double rhs), double rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const char *rhs), const char *rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const String &rhs), const String &rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const char *rhs), const char *rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const String &rhs), const String &rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const char *rhs), const char *rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const String &rhs), const String &rhs)
 
bool aunit::assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 

Detailed Description

Various assertXxx() macros are defined in this header.

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 45 of file Assertion.h.

◆ assertFalse

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

Assert that arg is false.

Definition at line 69 of file Assertion.h.

◆ assertLess

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

Assert that arg1 is less than arg2.

Definition at line 52 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 58 of file Assertion.h.

◆ assertMore

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

Assert that arg1 is more than arg2.

Definition at line 55 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 62 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 48 of file Assertion.h.

◆ assertOp

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

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

Definition at line 72 of file Assertion.h.

◆ assertTrue

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

Assert that arg is true.

Definition at line 66 of file Assertion.h.