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

Verbose versions of the macros in AssertMacros.h. 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)    assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2.
 
#define assertNotEqual(arg1, arg2)    assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2.
 
#define assertLess(arg1, arg2)    assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2.
 
#define assertMore(arg1, arg2)    assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2.
 
#define assertLessOrEqual(arg1, arg2)    assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2.
 
#define assertMoreOrEqual(arg1, arg2)    assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2.
 
#define assertStringCaseEqual(arg1, arg2)
 Assert that string arg1 is equal to string arg2, case-insensitive. More...
 
#define assertStringCaseNotEqual(arg1, arg2)
 Assert that string arg1 is not equal to string arg2, case-insensitive. More...
 
#define assertTrue(arg)   assertBoolVerboseInternal(arg,true)
 Assert that arg is true.
 
#define assertFalse(arg)   assertBoolVerboseInternal(arg,false)
 Assert that arg is false.
 
#define assertOpVerboseInternal(arg1, op, opName, arg2)
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertBoolVerboseInternal(arg, value)
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertNear(arg1, arg2, error)
 Assert that arg1 and arg2 are within error of each other. More...
 
#define assertNotNear(arg1, arg2, error)
 Assert that arg1 and arg2 are NOT within error of each other. More...
 
#define assertNoFatalFailure(statement)
 Assert that the inner 'statement' returns with no fatal assertions. More...
 

Detailed Description

Verbose versions of the macros in AssertMacros.h.

These capture the string of the actual arguments and pass them to the respective assertionVerbose() methods so that verbose messages can be printed.

Definition in file AssertVerboseMacros.h.

Macro Definition Documentation

◆ assertBoolVerboseInternal

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

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

Definition at line 87 of file AssertVerboseMacros.h.

◆ assertNear

#define assertNear (   arg1,
  arg2,
  error 
)
Value:
do { \
if (!assertionNearVerbose(__FILE__, __LINE__, \
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
"<=", aunit::internal::compareNear)) \
return;\
} while (false)

Assert that arg1 and arg2 are within error of each other.

Definition at line 93 of file AssertVerboseMacros.h.

◆ assertNoFatalFailure

#define assertNoFatalFailure (   statement)
Value:
do { \
statement; \
if (isDone()) return; \
} while (false)

Assert that the inner 'statement' returns with no fatal assertions.

This is required because AUnit does not use exceptions, so we have to check the assertion state after calling an inner function. This macro is similar to the ASSERT_NO_FATAL_FAILURE(statement) in GoogleTest.

Definition at line 114 of file AssertVerboseMacros.h.

◆ assertNotNear

#define assertNotNear (   arg1,
  arg2,
  error 
)
Value:
do { \
if (!assertionNearVerbose(__FILE__, __LINE__, \
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
">", aunit::internal::compareNotNear)) \
return;\
} while (false)

Assert that arg1 and arg2 are NOT within error of each other.

Definition at line 101 of file AssertVerboseMacros.h.

◆ assertOpVerboseInternal

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

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

Definition at line 80 of file AssertVerboseMacros.h.

◆ assertStringCaseEqual

#define assertStringCaseEqual (   arg1,
  arg2 
)
Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseEqual,\
"==",arg2)
#define assertOpVerboseInternal(arg1, op, opName, arg2)
Internal helper macro, shouldn't be called directly by users.

Assert that string arg1 is equal to string arg2, case-insensitive.

Definition at line 64 of file AssertVerboseMacros.h.

◆ assertStringCaseNotEqual

#define assertStringCaseNotEqual (   arg1,
  arg2 
)
Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseNotEqual,\
"!=",arg2)

Assert that string arg1 is not equal to string arg2, case-insensitive.

Definition at line 69 of file AssertVerboseMacros.h.