scsl 1.0.1
Shimmering Clarity Standard Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sctest::SimpleSuite Class Reference

SimpleSuite is a test-running harness for simple tests. More...

#include <SimpleSuite.h>

Public Member Functions

 SimpleSuite ()
 
void Silence ()
 Silence suppresses output.
 
void Setup (std::function< bool(void)> setupFn)
 Define a suite setup function.
 
void Teardown (std::function< bool(void)> teardownFn)
 Define a teardown function.
 
void AddTest (std::string label, std::function< bool(void)> test)
 Register a new simple test.
 
void AddFailingTest (std::string label, std::function< bool(void)> test)
 Register a test that is expected to return false.
 
bool Run ()
 Run all the registered tests.
 
void Reset ()
 Reporting methods.
 
bool HasRun () const
 Returns true if Run has been called.
 
Report GetReport ()
 Retrieve the test run results.
 

Detailed Description

SimpleSuite is a test-running harness for simple tests.

A simple test is defined as a test that takes no arguments and returns a boolean status where true indicates the test has passed.

Constructor & Destructor Documentation

◆ SimpleSuite()

sctest::SimpleSuite::SimpleSuite ( )

Member Function Documentation

◆ AddFailingTest()

void sctest::SimpleSuite::AddFailingTest ( std::string  label,
std::function< bool(void)>  test 
)

Register a test that is expected to return false.

Parameters
labelThe text that will identify test when running.
testThis test should return false if the test has passed.

◆ AddTest()

void sctest::SimpleSuite::AddTest ( std::string  label,
std::function< bool(void)>  test 
)

Register a new simple test.

Parameters
labelThe text that will identify test when running.
testThis test should return true if the test has passed.

◆ GetReport()

Report sctest::SimpleSuite::GetReport ( )

Retrieve the test run results.

The results will only be valid if Run has been called.

◆ HasRun()

bool sctest::SimpleSuite::HasRun ( ) const

Returns true if Run has been called.

◆ Reset()

void sctest::SimpleSuite::Reset ( )

Reporting methods.

Reset clears the report statistics.

Reset will preserve the setup and teardown functions, just resetting the suite's internal state.

◆ Run()

bool sctest::SimpleSuite::Run ( )

Run all the registered tests.

Returns
True if all tests have passed.

◆ Setup()

void sctest::SimpleSuite::Setup ( std::function< bool(void)>  setupFn)
inline

Define a suite setup function.

If present, this setup function is called At the start of the Run method, before tests are run. It should be a predicate: if it returns false, tests automatically fail.

◆ Silence()

void sctest::SimpleSuite::Silence ( )

Silence suppresses output.

◆ Teardown()

void sctest::SimpleSuite::Teardown ( std::function< bool(void)>  teardownFn)
inline

Define a teardown function.

If present, this teardown function is called At the end of the Run method, after all tests have run.


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