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

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

#include <stdint.h>
#include <Arduino.h>
#include "FCString.h"
#include "TestOnce.h"
#include "TestAgain.h"
Include dependency graph for TestMacro.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(test_class, name)
 Create a test that is derived from a custom TestOnce class. More...
 
#define testingF(test_class, name)
 Create a test that is derived from a custom TestAgain class. More...
 
#define externTestF(test_class, name)
 Create an extern reference to a testF() test case object defined elsewhere. More...
 
#define externTestingF(test_class, name)
 Create an extern reference to a testingF() test case object defined elsewhere. More...
 

Detailed Description

Various macros (test(), testing(), externTest(), externTesting()) are defined in this header.

Definition in file TestMacro.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 78 of file TestMacro.h.

◆ externTestF

#define externTestF (   test_class,
  name 
)
Value:
struct test_class ## _ ## name : test_class {\
test_class ## _ ## name();\
virtual void once() override;\
};\
extern test_class ## _ ## name test_class##_##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 131 of file TestMacro.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 90 of file TestMacro.h.

◆ externTestingF

#define externTestingF (   test_class,
  name 
)
Value:
struct test_class ## _ ## name : test_class {\
test_class ## _ ## name();\
virtual void again() override;\
};\
extern test_class ## _ ## name test_class##_##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 144 of file TestMacro.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(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 50 of file TestMacro.h.

◆ testF

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

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

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

Definition at line 101 of file TestMacro.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(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 64 of file TestMacro.h.

◆ testingF

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

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

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

Definition at line 116 of file TestMacro.h.