AUnit  1.7.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Public Member Functions | List of all members
aunit::TestOnce Class Referenceabstract

Similar to TestAgain but performs user-defined test only once. More...

#include <TestOnce.h>

Inheritance diagram for aunit::TestOnce:
Inheritance graph
[legend]
Collaboration diagram for aunit::TestOnce:
Collaboration graph
[legend]

Public Member Functions

 TestOnce ()
 Constructor.
 
void loop () override
 Calls the user-provided once() method. More...
 
virtual void once ()=0
 User-provided test case.
 
- Public Member Functions inherited from aunit::Test
 Test ()
 Empty constructor. More...
 
virtual void setup ()
 Optional method that performs any initialization. More...
 
virtual void teardown ()
 Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise. More...
 
void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
 
void expire ()
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 

Additional Inherited Members

- Static Public Member Functions inherited from aunit::Test
static Test ** getRoot ()
 Get the pointer to the root pointer. More...
 
- Static Public Attributes inherited from aunit::Test
static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 
- Protected Member Functions inherited from aunit::MetaAssertion
 MetaAssertion ()
 Empty constructor.
 
bool assertionTestStatus (const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
 Set the status of the current test using the 'ok' status from another test, and print the assertion message if requested.
 
bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message.
 
void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message.
 
- Protected Member Functions inherited from aunit::Assertion
 Assertion ()=default
 Empty constructor.
 
bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed.
 
bool assertionBool (const char *file, uint16_t line, bool arg, bool value)
 Used by assertTrue() and assertFalse().
 
bool assertion (const char *file, uint16_t line, bool lhs, const char *opName, bool(*op)(bool lhs, bool rhs), bool rhs)
 Used by assertXxx(bool, bool).
 
bool assertion (const char *file, uint16_t line, char lhs, const char *opName, bool(*op)(char lhs, char rhs), char rhs)
 Used by assertXxx(char, char).
 
bool assertion (const char *file, uint16_t line, int lhs, const char *opName, bool(*op)(int lhs, int rhs), int rhs)
 Used by assertXxx(int, int).
 
bool assertion (const char *file, uint16_t line, unsigned int lhs, const char *opName, bool(*op)(unsigned int lhs, unsigned int rhs), unsigned int rhs)
 Used by assertXxx(unsigned int, unsigned int).
 
bool assertion (const char *file, uint16_t line, long lhs, const char *opName, bool(*op)(long lhs, long rhs), long rhs)
 Used by assertXxx(long, long).
 
bool assertion (const char *file, uint16_t line, unsigned long lhs, const char *opName, bool(*op)(unsigned long lhs, unsigned long rhs), unsigned long rhs)
 Used by assertXxx(unsigned long, unsigned long).
 
bool assertion (const char *file, uint16_t line, long long lhs, const char *opName, bool(*op)(long long lhs, long long rhs), long long rhs)
 Used by assertXxx(long long, long long).
 
bool assertion (const char *file, uint16_t line, unsigned long long lhs, const char *opName, bool(*op)(unsigned long long lhs, unsigned long long rhs), unsigned long long rhs)
 Used by assertXxx(unsigned long long, unsigned long long).
 
bool assertion (const char *file, uint16_t line, double lhs, const char *opName, bool(*op)(double lhs, double rhs), double rhs)
 Used by assertXxx(double, double).
 
bool assertion (const char *file, uint16_t line, const void *lhs, const char *opName, bool(*op)(const void *lhs, const void *rhs), const void *rhs)
 Used by assertXxx(const void*, const void*).
 
bool assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const char *rhs), const char *rhs)
 Used by assertXxx(const char*, const char*).
 
bool assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const String &rhs), const String &rhs)
 Used by assertXxx(const char*, const String&).
 
bool assertion (const char *file, uint16_t line, const char *lhs, const char *opName, bool(*op)(const char *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 Used by assertXxx(const char*, const __FlashStringHelper*).
 
bool assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const char *rhs), const char *rhs)
 Used by assertXxx(const String&, const char*).
 
bool assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const String &rhs), const String &rhs)
 Used by assertXxx(const String&, const String&).
 
bool assertion (const char *file, uint16_t line, const String &lhs, const char *opName, bool(*op)(const String &lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 Used by assertXxx(const String&, const __FlashStringHelper*).
 
bool assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const char *rhs), const char *rhs)
 Used by assertXxx(const String&, const char*).
 
bool assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const String &rhs), const String &rhs)
 Used by assertXxx(const __FlashStringHelper*, const String&).
 
bool assertion (const char *file, uint16_t line, const __FlashStringHelper *lhs, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs)
 Used by assertXxx( const __FlashStringHelper*, const __FlashStringHelper*).
 
bool assertionNear (const char *file, uint16_t line, int lhs, int rhs, int error, const char *opName, bool(*compareNear)(int lhs, int rhs, int error))
 Used by assertNear(int, int).
 
bool assertionNear (const char *file, uint16_t line, unsigned int lhs, unsigned int rhs, unsigned int error, const char *opName, bool(*compareNear)(unsigned int lhs, unsigned int rhs, unsigned int error))
 Used by assertNear(unsigned int, unsigned int).
 
bool assertionNear (const char *file, uint16_t line, long lhs, long rhs, long error, const char *opName, bool(*compareNear)(long lhs, long rhs, long error))
 Used by assertNear(long, long).
 
bool assertionNear (const char *file, uint16_t line, unsigned long lhs, unsigned long rhs, unsigned long error, const char *opName, bool(*compareNear)(unsigned long lhs, unsigned long rhs, unsigned long error))
 Used by assertNear(unsigned long, unsigned long).
 
bool assertionNear (const char *file, uint16_t line, double lhs, double rhs, double error, const char *opName, bool(*compareNear)(double lhs, double rhs, double error))
 Used by assertNear(double, double).
 
bool assertionBoolVerbose (const char *file, uint16_t line, bool arg, const __FlashStringHelper *argString, bool value)
 Used by assertTrue() and assertFalse().
 
bool assertionVerbose (const char *file, uint16_t line, bool lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(bool lhs, bool rhs), bool rhs, const __FlashStringHelper *rhsString)
 Used by assertEqual(bool, bool).
 
bool assertionVerbose (const char *file, uint16_t line, char lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(char lhs, char rhs), char rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(char, char).
 
bool assertionVerbose (const char *file, uint16_t line, int lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(int lhs, int rhs), int rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(int, int).
 
bool assertionVerbose (const char *file, uint16_t line, unsigned int lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(unsigned int lhs, unsigned int rhs), unsigned int rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(unsigned int, unsigned int).
 
bool assertionVerbose (const char *file, uint16_t line, long lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(long lhs, long rhs), long rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(long, long).
 
bool assertionVerbose (const char *file, uint16_t line, unsigned long lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(unsigned long lhs, unsigned long rhs), unsigned long rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(unsigned long, unsigned long).
 
bool assertionVerbose (const char *file, uint16_t line, long long lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(long long lhs, long long rhs), long long rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(long long, long long).
 
bool assertionVerbose (const char *file, uint16_t line, unsigned long long lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(unsigned long long lhs, unsigned long long rhs), unsigned long long rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(unsigned long long, unsigned long long).
 
bool assertionVerbose (const char *file, uint16_t line, double lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(double lhs, double rhs), double rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(double, double).
 
bool assertionVerbose (const char *file, uint16_t line, const void *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const void *lhs, const void *rhs), const void *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const void*, const void*).
 
bool assertionVerbose (const char *file, uint16_t line, const char *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const char *lhs, const char *rhs), const char *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const char*, const char*).
 
bool assertionVerbose (const char *file, uint16_t line, const char *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const char *lhs, const String &rhs), const String &rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const char*, const String&).
 
bool assertionVerbose (const char *file, uint16_t line, const char *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const char *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const char*, const __FlashStringHelper*).
 
bool assertionVerbose (const char *file, uint16_t line, const String &lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const String &lhs, const char *rhs), const char *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const String&, const char*).
 
bool assertionVerbose (const char *file, uint16_t line, const String &lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const String &lhs, const String &rhs), const String &rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const String&, const String&).
 
bool assertionVerbose (const char *file, uint16_t line, const String &lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const String &lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const String&, const __FlashStringHelper*).
 
bool assertionVerbose (const char *file, uint16_t line, const __FlashStringHelper *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const char *rhs), const char *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const String&, const char*).
 
bool assertionVerbose (const char *file, uint16_t line, const __FlashStringHelper *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const String &rhs), const String &rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx(const __FlashStringHelper*, const String&).
 
bool assertionVerbose (const char *file, uint16_t line, const __FlashStringHelper *lhs, const __FlashStringHelper *lhsString, const char *opName, bool(*op)(const __FlashStringHelper *lhs, const __FlashStringHelper *rhs), const __FlashStringHelper *rhs, const __FlashStringHelper *rhsString)
 Used by assertXxx( const __FlashStringHelper*, const __FlashStringHelper*).
 
bool assertionNearVerbose (const char *file, uint16_t line, int lhs, const __FlashStringHelper *lhsString, int rhs, const __FlashStringHelper *rhsString, int error, const __FlashStringHelper *errorString, const char *opName, bool(*compareNear)(int lhs, int rhs, int error))
 Used by assertNear(int, int).
 
bool assertionNearVerbose (const char *file, uint16_t line, unsigned int lhs, const __FlashStringHelper *lhsString, unsigned int rhs, const __FlashStringHelper *rhsString, unsigned int error, const __FlashStringHelper *errorString, const char *opName, bool(*compareNear)(unsigned int lhs, unsigned int rhs, unsigned int error))
 Used by assertNear(unsigned int, unsigned int).
 
bool assertionNearVerbose (const char *file, uint16_t line, long lhs, const __FlashStringHelper *lhsString, long rhs, const __FlashStringHelper *rhsString, long error, const __FlashStringHelper *errorString, const char *opName, bool(*compareNear)(long lhs, long rhs, long error))
 Used by assertNear(long, long).
 
bool assertionNearVerbose (const char *file, uint16_t line, unsigned long lhs, const __FlashStringHelper *lhsString, unsigned long rhs, const __FlashStringHelper *rhsString, unsigned long error, const __FlashStringHelper *errorString, const char *opName, bool(*compareNear)(unsigned long lhs, unsigned long rhs, unsigned long error))
 Used by assertNear(unsigned long, unsigned long).
 
bool assertionNearVerbose (const char *file, uint16_t line, double lhs, const __FlashStringHelper *lhsString, double rhs, const __FlashStringHelper *rhsString, double error, const __FlashStringHelper *errorString, const char *opName, bool(*compareNear)(double lhs, double rhs, double error))
 Used by assertNear(double, double).
 
- Protected Member Functions inherited from aunit::Test
void fail ()
 Mark the test as failed. More...
 
void pass ()
 Mark the test as passed. More...
 
void init (const char *name)
 
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity.
 
- Static Protected Attributes inherited from aunit::MetaAssertion
static const char kMessageDone []
 
static const char kMessageNotDone [] = "not done"
 
static const char kMessagePassed [] = "passed"
 
static const char kMessageNotPassed [] = "not passed"
 
static const char kMessageFailed [] = "failed"
 
static const char kMessageNotFailed [] = "not failed"
 
static const char kMessageSkipped [] = "skipped"
 
static const char kMessageNotSkipped [] = "not skipped"
 
static const char kMessageExpired [] = "timed out"
 
static const char kMessageNotExpired [] = "not timed out"
 

Detailed Description

Similar to TestAgain but performs user-defined test only once.

Definition at line 40 of file TestOnce.h.

Member Function Documentation

◆ loop()

void aunit::TestOnce::loop ( )
overridevirtual

Calls the user-provided once() method.

If no other assertXxx() macros set the internal status, then this calls pass() to make sure that this test case will be called only once from Test::run().

Implements aunit::Test.

Definition at line 29 of file TestOnce.cpp.


The documentation for this class was generated from the following files: