Corrade::TestSuite namespace

Test suite.

Testing and benchmarking framework. See Testing and benchmarking for more information.

This library is built if CORRADE_WITH_TESTSUITE is enabled when building Corrade. To use this library with CMake, request the TestSuite component of the Corrade package and link to the Corrade::TestSuite target. Most commonly you'll be using it through the corrade_add_test() macro as described in the tutorial:

find_package(Corrade REQUIRED TestSuite)

# Link a test app to the library
target_link_libraries(your-app PRIVATE Corrade::TestSuite)

# Or create a test directly from the sources
corrade_add_test(YourTest YourTest.cpp)

In case you're building for Emscripten and want to run your tests via CTest, you also need to put FindNodeJs.cmake in your modules/ directory.

See also Downloading and building Corrade and Using Corrade with CMake for more information.

Namespaces

namespace Compare
Various test suite comparison helpers.

Classes

template<class T>
class Comparator
Default comparator implementation.
template<>
class Comparator<double>
Fuzzy-compare for double values.
template<>
class Comparator<float>
Fuzzy-compare for float values.
template<>
class Comparator<long double>
Fuzzy-compare for long double values.
class TestCaseDescriptionSourceLocation new in Git master
Instanced test case description with source location.
class Tester
Base class for tests and benchmarks.

Enums

enum class ComparisonStatusFlag: unsigned char { Failed = 1 << 0, Warning = 1 << 1, Message = 1 << 2, Verbose = 1 << 3, Diagnostic = 1 << 4, VerboseDiagnostic = 1 << 5 }
Comparison status flag.

Typedefs

using ComparisonStatusFlags = Containers::EnumSet<ComparisonStatusFlag>
Comparison status flags.

Functions

auto operator<<(Utility::Debug& debug, ComparisonStatusFlag value) -> Utility::Debug&
Debug output operator.
auto operator<<(Utility::Debug& debug, ComparisonStatusFlags value) -> Utility::Debug&
Debug output operator.

Enum documentation

enum class Corrade::TestSuite::ComparisonStatusFlag: unsigned char

Comparison status flag.

Enumerators
Failed

The comparison failed. Absence of this flag indicates success. If this is returned from Comparator::operator()(), the Tester then calls Comparator::printMessage().

Warning

The comparison wants to print a warning. If this is returned from Comparator::operator()(), Tester then calls Comparator::printMessage().

Message

The comparison wants to print a message. If this is returned from Comparator::operator()(), Tester then calls Comparator::printMessage(). Should be used only seldom to avoid spamming the output, prefer to use ComparisonStatusFlag::Verbose instead.

Verbose

The comparison can print a verbose message. If this is returned from Comparator::operator()() and the --verbose command-line option is specified, Tester then calls Comparator::printMessage().

Diagnostic

The comparison can save a comparison diagnostic to a file. If this is returned from Comparator::operator()(), the comparator needs to implement an additional Comparator::saveDiagnostic() function, which is called in case the --save-diagnostic command-line option is specified. See Saving diagnostic files for more information.

VerboseDiagnostic

The comparison can save a verbose comparison diagnostic to a file. If this is is returned from Comparator::operator()(), the comparator needs to implement an additional Comparator::saveDiagnostic() function. This function gets called in case both the --save-diagnostic and --verbose command-line options are specified. See Saving diagnostic files for more information.

Typedef documentation

typedef Containers::EnumSet<ComparisonStatusFlag> Corrade::TestSuite::ComparisonStatusFlags

Comparison status flags.

Function documentation

Utility::Debug& Corrade::TestSuite::operator<<(Utility::Debug& debug, ComparisonStatusFlag value)

Debug output operator.

Utility::Debug& Corrade::TestSuite::operator<<(Utility::Debug& debug, ComparisonStatusFlags value)

Debug output operator.