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

Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. More...

#include <stdint.h>
#include <Arduino.h>
#include "Flash.h"
#include "FCString.h"
#include "TestOnce.h"
#include "TestAgain.h"
Include dependency graph for TestMacros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define test(name)
 Macro to define a test that will be run only once. More...
 
#define testing(name)
 Macro to define a test that will run repeatly upon each iteration of the global loop() method, stopping when the something calls Test::pass(), Test::fail() or Test::skip(). More...
 
#define externTest(name)
 Create an extern reference to a test() test case object defined elsewhere. More...
 
#define externTesting(name)
 Create an extern reference to a testing() test case object defined elsewhere. More...
 
#define testF(testClass, name)
 Create a test that is derived from a custom TestOnce class. More...
 
#define testingF(testClass, name)
 Create a test that is derived from a custom TestAgain class. More...
 
#define externTestF(testClass, name)
 Create an extern reference to a testF() test case object defined elsewhere. More...
 
#define externTestingF(testClass, name)
 Create an extern reference to a testingF() test case object defined elsewhere. More...
 

Detailed Description

Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.

Definition in file TestMacros.h.

Macro Definition Documentation

◆ externTest

#define externTest (   name)
Value:
struct test_ ## name : aunit::TestOnce {\
test_ ## name();\
void once();\
};\
extern test_##name test_##name##_instance
virtual void once()=0
User-provided test case.
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40

Create an extern reference to a test() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 84 of file TestMacros.h.

◆ externTestF

#define externTestF (   testClass,
  name 
)
Value:
struct testClass ## _ ## name : testClass {\
testClass ## _ ## name();\
virtual void once() override;\
};\
extern testClass ## _ ## name testClass##_##name##_instance

Create an extern reference to a testF() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 137 of file TestMacros.h.

◆ externTesting

#define externTesting (   name)
Value:
struct test_ ## name : aunit::TestAgain {\
test_ ## name();\
void again();\
};\
extern test_##name test_##name##_instance
virtual void again()=0
User-provided test case.
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37

Create an extern reference to a testing() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 96 of file TestMacros.h.

◆ externTestingF

#define externTestingF (   testClass,
  name 
)
Value:
struct testClass ## _ ## name : testClass {\
testClass ## _ ## name();\
virtual void again() override;\
};\
extern testClass ## _ ## name testClass##_##name##_instance

Create an extern reference to a testingF() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 150 of file TestMacros.h.

◆ test

#define test (   name)
Value:
struct test_ ## name : aunit::TestOnce {\
test_ ## name();\
virtual void once() override;\
} test_ ## name ## _instance;\
test_ ## name :: test_ ## name() {\
init(AUNIT_F(#name)); \
}\
void test_ ## name :: once()
virtual void once()=0
User-provided test case.
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40

Macro to define a test that will be run only once.

Definition at line 56 of file TestMacros.h.

◆ testF

#define testF (   testClass,
  name 
)
Value:
struct testClass ## _ ## name : testClass {\
testClass ## _ ## name();\
virtual void once() override;\
} testClass ## _ ## name ## _instance;\
testClass ## _ ## name :: testClass ## _ ## name() {\
init(AUNIT_F(#testClass "_" #name));\
}\
void testClass ## _ ## name :: once()

Create a test that is derived from a custom TestOnce class.

The name of the instance is prefixed by '{testClass}_' to avoid name collisions with similarly named tests using other fixtures.

Definition at line 107 of file TestMacros.h.

◆ testing

#define testing (   name)
Value:
struct test_ ## name : aunit::TestAgain {\
test_ ## name();\
virtual void again() override;\
} test_ ## name ## _instance;\
test_ ## name :: test_ ## name() {\
init(AUNIT_F(#name));\
}\
void test_ ## name :: again()
virtual void again()=0
User-provided test case.
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37

Macro to define a test that will run repeatly upon each iteration of the global loop() method, stopping when the something calls Test::pass(), Test::fail() or Test::skip().

Definition at line 70 of file TestMacros.h.

◆ testingF

#define testingF (   testClass,
  name 
)
Value:
struct testClass ## _ ## name : testClass {\
testClass ## _ ## name();\
virtual void again() override;\
} testClass ## _ ## name ## _instance;\
testClass ## _ ## name :: testClass ## _ ## name() {\
init(AUNIT_F(#testClass "_" #name));\
}\
void testClass ## _ ## name :: again()

Create a test that is derived from a custom TestAgain class.

The name of the instance is prefixed by '{testClass}_' to avoid name collisions with similarly named tests using other fixtures.

Definition at line 122 of file TestMacros.h.