Corrade::TestSuite namespace

Test suite.

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

This library is built if WITH_TESTSUITE is enabled when building Corrade. To use this library with CMake, you need to request the TestSuite component of the Corrade package and link to the Corrade::TestSuite target:

find_package(Corrade REQUIRED TestSuite)

# ...
target_link_libraries(your-app Corrade::TestSuite)

In case you're building for Emscripten and want to run your tests via CTest, you also need to copy FindNodeJs.cmake from the modules/ directory in Corrade sources to a modules/ dir in your project and pointing CMAKE_MODULE_PATH to it (if not done already) so it is able to find the Node.js executable:

# Path where FindNodeJs.cmake and others can be found, adapt as needed
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})

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 Tester
Base class for tests and benchmarks.

Enums

enum class ComparisonStatusFlag: std::uint8_t { 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: std::uint8_t

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 seldomly 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.