ZeroErr
zeroerr::TestContext Class Reference

TestContext is a class that holds the test results and reporter context. There are 8 different matrices that are used to store the test results. More...

#include <unittest.h>

Collaboration diagram for zeroerr::TestContext:

Public Member Functions

int add (TestContext &local)
 Add the subtest results to the matrices. More...
 
void reset ()
 Reset the matrices to 0. More...
 
void save_output ()
 Save the output of the test to the correct_output_path as a golden file. More...
 
 TestContext (IReporter &reporter)
 Construct a new Test Context object. More...
 
 ~TestContext ()=default
 

Public Attributes

unsigned passed = 0
 
unsigned warning = 0
 
unsigned failed = 0
 
unsigned skipped = 0
 
unsigned passed_as = 0
 
unsigned warning_as = 0
 
unsigned failed_as = 0
 
unsigned skipped_as = 0
 
IReporterreporter
 

Detailed Description

TestContext is a class that holds the test results and reporter context. There are 8 different matrices that are used to store the test results.

  • passed : Number of passed tests
  • warning : Number of tests that passed with warning
  • failed : Number of failed tests
  • skipped : Number of skipped tests
  • passed_as : Number of passed tests in assertion
  • warning_as: Number of tests that passed with warning in assertion
  • failed_as : Number of failed tests in assertion
  • skipped_as: Number of skipped tests in assertion

Constructor & Destructor Documentation

◆ TestContext()

zeroerr::TestContext::TestContext ( IReporter reporter)
inline

Construct a new Test Context object.

Parameters
reporterThe reporter object that will be used to report the test results.

◆ ~TestContext()

zeroerr::TestContext::~TestContext ( )
default

Member Function Documentation

◆ add()

int zeroerr::TestContext::add ( TestContext local)

Add the subtest results to the matrices.

Parameters
localThe local test context that will be added to the global context.
Returns
int 0 if the test passed, 1 if the test passed with warning, 2 if the test failed.

◆ reset()

void zeroerr::TestContext::reset ( )

Reset the matrices to 0.

◆ save_output()

void zeroerr::TestContext::save_output ( )

Save the output of the test to the correct_output_path as a golden file.

Member Data Documentation

◆ failed

unsigned zeroerr::TestContext::failed = 0

◆ failed_as

unsigned zeroerr::TestContext::failed_as = 0

◆ passed

unsigned zeroerr::TestContext::passed = 0

◆ passed_as

unsigned zeroerr::TestContext::passed_as = 0

◆ reporter

IReporter& zeroerr::TestContext::reporter

◆ skipped

unsigned zeroerr::TestContext::skipped = 0

◆ skipped_as

unsigned zeroerr::TestContext::skipped_as = 0

◆ warning

unsigned zeroerr::TestContext::warning = 0

◆ warning_as

unsigned zeroerr::TestContext::warning_as = 0

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