41 class __FlashStringHelper;
50 #define test(name) struct test_ ## name : aunit::TestOnce {\ 52 virtual void once() override;\ 53 } test_ ## name ## _instance;\ 54 test_ ## name :: test_ ## name() : TestOnce(F(#name)) {}\ 55 void test_ ## name :: once() 62 #define testing(name) struct test_ ## name : aunit::Test {\ 64 virtual void loop() override;\ 65 } test_ ## name ## _instance;\ 66 test_ ## name :: test_ ## name() : Test(F(#name)) {}\ 67 void test_ ## name :: loop() 74 #define externTest(name) struct test_ ## name : aunit::TestOnce {\ 78 extern test_##name test_##name##_instance 86 #define externTesting(name) struct test_ ## name : aunit::Test {\ 90 extern test_##name test_##name##_instance 135 explicit Test(
const char* name);
142 explicit Test(
const __FlashStringHelper* name);
155 virtual void loop() = 0;
222 Test& operator=(
const Test&) =
delete;
240 explicit TestOnce(
const __FlashStringHelper* name):
248 virtual void loop()
override;
251 virtual void once() = 0;
virtual void once()=0
User-provided test case.
Base class of all test cases.
void expire()
Mark the test as expired (i.e.
TestOnce(const __FlashStringHelper *name)
Constructor.
static const uint8_t kStatusFailed
Test has failed, or failed() was called.
static const uint8_t kStatusNew
Test is new, needs to be setup.
void fail()
Mark the test as failed.
Similar to Test but performs the loop() method only once.
Test(const char *name)
Constructor taking the name of the given test case.
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
bool isNotDone()
Return true if test is done (passed, failed, skipped, expired).
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
bool isNotPassed()
Return true if test is passed.
Test ** getNext()
Return the next pointer as a pointer to the pointer, similar to getRoot().
static const uint8_t kStatusSkipped
Test is skipped, through the exclude() method or skip() was called.
bool isPassed()
Return true if test is passed.
virtual void setup()
Optional method that performs any initialization.
virtual void loop()=0
The user-provided test case function.
void pass()
Mark the test as passed.
static Test ** getRoot()
Get the pointer to the root pointer.
bool isExpired()
Return true if test is expired.
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
void skip()
Mark the test as skipped.
bool isDone()
Return true if test is done (passed, failed, skipped, expired).
bool isNotFailed()
Return true if test is failed.
bool isFailed()
Return true if test is failed.
TestOnce(const char *name)
Constructor.
virtual void loop() override
Calls the user-provided once() method.
static const uint8_t kStatusSetup
Test is set up.
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
bool isNotSkipped()
Return true if test isNot skipped.
const FCString & getName()
Get the name of the test.
bool isSkipped()
Return true if test isNot skipped.
bool isNotExpired()
Return true if test is expired.
void setStatus(uint8_t status)
Set the status of the test.
uint8_t getStatus()
Get the status of the test.