APM:Libraries
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Test Class Reference

#include <AP_Test.h>

Public Member Functions

 Test (const char *name)
 
 ~Test ()
 
void require (bool expr, const char *source)
 

Static Public Member Functions

static void report ()
 

Private Attributes

const char * _name
 name of the current test More...
 
bool _fail
 set if any ::require calls indicate the test failed More...
 

Static Private Attributes

static int16_t _passed = 0
 global pass count More...
 
static int16_t _failed = 0
 global fail count More...
 

Detailed Description

Unit test state and methods.

Definition at line 42 of file AP_Test.h.

Constructor & Destructor Documentation

◆ Test()

Test::Test ( const char *  name)

Constructor - creates a new test.

Normally called by the TEST macro.

Parameters
nameThe name of the test being started.

Constructor

Definition at line 78 of file AP_Test.h.

◆ ~Test()

Test::~Test ( )

Destructor - ends the test.

Destructor

Definition at line 86 of file AP_Test.h.

Member Function Documentation

◆ report()

void Test::report ( )
static

Report the overall number of tests/pass/fails.

Summary report

Definition at line 110 of file AP_Test.h.

◆ require()

void Test::require ( bool  expr,
const char *  source 
)

Perform a success check.

Parameters
exprIf false, the test has failed.
sourceThe expression source; emitted in the diagnostic indicating test failure.

Success check

Definition at line 99 of file AP_Test.h.

Member Data Documentation

◆ _fail

bool Test::_fail
private

set if any ::require calls indicate the test failed

Definition at line 71 of file AP_Test.h.

Referenced by require(), and ~Test().

◆ _failed

int16_t Test::_failed = 0
staticprivate

global fail count

Definition at line 73 of file AP_Test.h.

Referenced by report(), and ~Test().

◆ _name

const char* Test::_name
private

name of the current test

Definition at line 70 of file AP_Test.h.

Referenced by require(), and ~Test().

◆ _passed

int16_t Test::_passed = 0
staticprivate

global pass count

Definition at line 72 of file AP_Test.h.

Referenced by report(), and ~Test().


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