Corrade::TestSuite::Compare namespace

Various test suite comparison helpers.

See Advanced comparisons, CORRADE_COMPARE_AS(), CORRADE_COMPARE_WITH() and Comparator 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 in CMake and link to the Corrade::TestSuite target:

find_package(Corrade REQUIRED TestSuite)

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

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

Classes

class Aligned new in Git master
Pseudo-type for verifying that a pointer is aligned.
template<class T>
class Around
Pseudo-type for verifying that value is in given bounds.
template<class>
class Container
Pseudo-type for comparing container contents.
template<class T>
class Divisible new in 2020.06
Pseudo-type for verifying that value is divisible by.
class File
Pseudo-type for comparing file contents.
class FileToString
Pseudo-type for comparing file contents to string.
template<class T>
class Greater
Pseudo-type for verifying that value is greater than expected.
template<class T>
class GreaterOrEqual
Pseudo-type for verifying that value is greater than or equal to expected.
template<class T>
class Less
Pseudo-type for verifying that value is less than expected.
template<class T>
class LessOrEqual
Pseudo-type for verifying that value is less than or equal to expected.
class NotAligned new in Git master
Pseudo-type for verifying that value is not divisible by.
template<class T>
class NotDivisible new in 2020.06
Pseudo-type for verifying that value is not divisible by.
template<class T>
class NotEqual new in Git master
Pseudo-type for verifying that value is not equal to.
template<class T>
class SortedContainer
Pseudo-type for comparing sorted container contents.
class String new in Git master
Pseudo-type for comparing two strings.
class StringContains new in Git master
Pseudo-type for verifying that a string contains given substring.
class StringHasPrefix new in Git master
Pseudo-type for verifying that a string has given prefix.
class StringHasSuffix new in Git master
Pseudo-type for verifying that a string has given suffix.
class StringNotContains new in Git master
Pseudo-type for verifying that a string does not contain given substring.
class StringToFile
Pseudo-type for comparing string to file contents.

Functions

template<class T>
auto around(T epsilon) -> Around<T>
Make a pseudo-type for verifying that value is in given bounds.

Function documentation

template<class T>
Around<T> Corrade::TestSuite::Compare::around(T epsilon)

Make a pseudo-type for verifying that value is in given bounds.

Convenience wrapper around Around::Around(T). These two lines are equivalent:

float a = ;
CORRADE_COMPARE_WITH(a, 9.28f, TestSuite::Compare::Around<float>{0.1f});
CORRADE_COMPARE_WITH(a, 9.28f, TestSuite::Compare::around(0.1f));