TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
Customization Points

Macros

#define TTS_CUSTOM_DRIVER_FUNCTION
 Test application entry-point customization.
 
#define TTS_MAIN
 Identify the file containing tests entry point.
 

Functions

void tts::initialize (int argc, char const **argv)
 Initializes a TTS test suite.
 
int tts::report (int fails, int invalids)
 Test reporting customization point.
 

Macro Definition Documentation

◆ TTS_CUSTOM_DRIVER_FUNCTION

#define TTS_CUSTOM_DRIVER_FUNCTION

#include <tts/engine/main.hpp>

Test application entry-point customization.

In case where the main function is to be provided externally, one can redefine TTS_CUSTOM_DRIVER_FUNCTION in order to specify the name of the test executable entry point.

See also
TTS_MAIN
tts::initialize
tts::report

Example

#define TTS_MAIN
#define TTS_CUSTOM_DRIVER_FUNCTION my_test_main
#include <tts/tts.hpp>
#include <iostream>
TTS_CASE("Some test") {};
int main(int argc, char const** argv)
{
std::cout << "Initializing tests...\n";
::tts::initialize(argc, argv);
std::cout << "Running tests...\n";
my_test_main(argc, argv);
std::cout << "Finalizing tests...\n";
return ::tts::report(0, 1);
}
void initialize(int argc, char const **argv)
Initializes a TTS test suite.
Definition options.hpp:192
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition case.hpp:139

◆ TTS_MAIN

#define TTS_MAIN

#include <tts/engine/main.hpp>

Identify the file containing tests entry point.

Users can dispatch tests in multiple Translation Units to be linked afterward. In this scenario, one single Translation Unit must define TTS_MAIN to generate the test entry point function.

Function Documentation

◆ initialize()

void tts::initialize ( int  argc,
char const **  argv 
)
inline

#include <tts/tools/options.hpp>

Initializes a TTS test suite.

This function is to be called when writing a custom entry point.

Parameters
argcNumber of command line argument fetched from main
argvCommand line arguments pointer fetched from main
See also
TTS_CUSTOM_DRIVER_FUNCTION

◆ report()

int tts::report ( int  fails,
int  invalids 
)
inline

#include <tts/engine/environment.hpp>

Test reporting customization point.

Aggregates test results and validate the whole test suite with respect to expect numbers of failures and invalids.

Parameters
failsNumber of expected failures.
invalidsNumber of expected invalid tests.
Returns
0 if all tests passed and 1 otherwise.