Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::TestReport Struct Reference

Collects multiple TestCase and reports their results. More...

#include <Testing.h>

Classes

struct  IOutput
 
struct  Output
 

Public Member Functions

 TestReport (IOutput &console, int argc, const char **argv)
 Build from a console and executable arguments.
 
int getTestReturnCode () const
 Gets return code for this process.
 
bool hasStartupFailure () const
 Returns true when startup path resolution failed before tests ran.
 
uint16_t mapPort (uint16_t basePort) const
 Applies an optional port offset configured through command line or environment.
 
bool isTestExplicitlySelected (StringSpan testName) const
 Returns true only when --test explicitly matches testName.
 
bool isTestEnabled (StringSpan testName) const
 Returns true when testName is enabled by the current test selection.
 
template<typename Statistics >
void runGlobalMemoryReport (Statistics stats, bool reportFailure=true)
 

Public Attributes

IOutput & console
 
StringPath libraryRootDirectory
 Path to sources directory for library.
 
StringPath executableFile
 Path to current executable.
 
StringPath applicationRootDirectory
 Path to application (on macOS is different from executable path)
 
bool abortOnFirstFailedTest = true
 If true will abort after first failed test.
 
bool debugBreakOnFailedTest = true
 If true will issue a debugger halt when a test fails.
 
bool quietMode = false
 If true will not print recaps at start or end of the test.
 
bool runAllTests = false
 If true will run optional/slow tests that are skipped by default.
 

Friends

struct TestCase
 

Detailed Description

Collects multiple TestCase and reports their results.

This is passed as argument to SC::TestCase derived classes, and contains handle to globals like a console, paths to the library and application root, path to executable etc.

Constructor & Destructor Documentation

◆ TestReport()

SC::TestReport::TestReport ( IOutput & console,
int argc,
const char ** argv )

Build from a console and executable arguments.

Parameters
consoleA Console object where to print test results
argcNumber of command line arguments
argvCommand line arguments Arguments

Member Function Documentation

◆ getTestReturnCode()

int SC::TestReport::getTestReturnCode ( ) const
nodiscard

Gets return code for this process.

Returns
-1 if tests are failed, 0 if tests are successful

◆ hasStartupFailure()

bool SC::TestReport::hasStartupFailure ( ) const
inlinenodiscard

Returns true when startup path resolution failed before tests ran.

◆ isTestEnabled()

bool SC::TestReport::isTestEnabled ( StringSpan testName) const
nodiscard

Returns true when testName is enabled by the current test selection.

Parameters
testNameName of test case to evaluate

◆ isTestExplicitlySelected()

bool SC::TestReport::isTestExplicitlySelected ( StringSpan testName) const
nodiscard

Returns true only when --test explicitly matches testName.

Parameters
testNameName of test case to evaluate

◆ mapPort()

uint16_t SC::TestReport::mapPort ( uint16_t basePort) const
nodiscard

Applies an optional port offset configured through command line or environment.

Parameters
basePortThe default test port
Returns
The mapped port (basePort + portOffset if representable as uint16_t)

Member Data Documentation

◆ abortOnFirstFailedTest

bool SC::TestReport::abortOnFirstFailedTest = true

If true will abort after first failed test.

◆ applicationRootDirectory

StringPath SC::TestReport::applicationRootDirectory

Path to application (on macOS is different from executable path)

◆ debugBreakOnFailedTest

bool SC::TestReport::debugBreakOnFailedTest = true

If true will issue a debugger halt when a test fails.

◆ executableFile

StringPath SC::TestReport::executableFile

Path to current executable.

◆ libraryRootDirectory

StringPath SC::TestReport::libraryRootDirectory

Path to sources directory for library.

◆ quietMode

bool SC::TestReport::quietMode = false

If true will not print recaps at start or end of the test.

◆ runAllTests

bool SC::TestReport::runAllTests = false

If true will run optional/slow tests that are skipped by default.


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