API Documentation
Static Public Member Functions | List of all members
nkDebug::TestUtils Class Referencefinal

Utilities to write tests. More...

Static Public Member Functions

static void check (bool condition, nkMemory::StringView message="")
 
template<typename T >
static void areEqual (const T &a, const T &b, nkMemory::StringView message="")
 
template<typename T >
static std::enable_if_t<!std::is_pointer_v< T >, void > areEqual (T a, T b, T precision, nkMemory::StringView message="")
 
template<typename T >
static void areNotEqual (const T &a, const T &b, nkMemory::StringView message="")
 
template<typename T >
static std::enable_if_t<!std::is_pointer_v< T >, void > areNotEqual (T a, T b, T precision, nkMemory::StringView message="")
 
template<typename T >
static void isNull (T *p, nkMemory::StringView message="")
 
template<typename T >
static void isNotNull (T *p, nkMemory::StringView message="")
 
template<typename T = char*>
static void areEqual (char *a, char *b, nkMemory::StringView message="")
 
template<typename T = const char*>
static void areEqual (const char *const &a, const char *const &b, nkMemory::StringView message="")
 
template<typename T = char*>
static void areNotEqual (char *a, char *b, nkMemory::StringView message="")
 
template<typename T = const char*>
static void areNotEqual (const char *const &a, const char *const &b, nkMemory::StringView message="")
 
template<typename T = const char*>
static void areEqual (const char *a, const char *b, const char *precision, nkMemory::StringView message)=delete
 

Detailed Description

Utilities to write tests.

Member Function Documentation

◆ check()

static void nkDebug::TestUtils::check ( bool  condition,
nkMemory::StringView  message = "" 
)
static

Allows to check a condition and fail if it resolves to false.

Parameters
conditionThe condition to check for.
messageThe message to provide in case of a failure.

◆ areEqual() [1/5]

template<typename T >
static void nkDebug::TestUtils::areEqual ( const T &  a,
const T &  b,
nkMemory::StringView  message = "" 
)
static

Checks that two objects are equal, failing if it's not the case.

Parameters
aThe a member of the equality check.
bThe b member of the equality check.
messageThe message to provide in case of a failure.

◆ areEqual() [2/5]

template<typename T >
static std::enable_if_t<!std::is_pointer_v<T>, void> nkDebug::TestUtils::areEqual ( a,
b,
precision,
nkMemory::StringView  message = "" 
)
static

Checks that two objects are equal, failing if it's not the case.

Parameters
aThe a member of the equality check.
bThe b member of the equality check.
precisionThe maximal numerial precision the equality should satisfy (for instance, a check of equality with 2.f with precision of 0.1f will accept a range between 1.9f and 2.1f).
messageThe message to provide in case of a failure.

◆ areNotEqual() [1/4]

template<typename T >
static void nkDebug::TestUtils::areNotEqual ( const T &  a,
const T &  b,
nkMemory::StringView  message = "" 
)
static

Checks that two objects are not equal, failing if it's not the case.

Parameters
aThe a member of the equality check.
bThe b member of the equality check.
messageThe message to provide in case of a failure.

◆ areNotEqual() [2/4]

template<typename T >
static std::enable_if_t<!std::is_pointer_v<T>, void> nkDebug::TestUtils::areNotEqual ( a,
b,
precision,
nkMemory::StringView  message = "" 
)
static

Checks that two objects are not equal, failing if it's not the case.

Parameters
aThe a member of the equality check.
bThe b member of the equality check.
precisionThe maximal numerial precision the equality should satisfy (for instance, a check of equality with 2.f with precision of 0.1f will reject a range between 1.9f and 2.1f).
messageThe message to provide in case of a failure.

◆ isNull()

template<typename T >
static void nkDebug::TestUtils::isNull ( T *  p,
nkMemory::StringView  message = "" 
)
static

Checks that a pointer is null, failing if it's not the case.

Parameters
pThe pointer to check.
messageThe message to provide in case of a failure.

◆ isNotNull()

template<typename T >
static void nkDebug::TestUtils::isNotNull ( T *  p,
nkMemory::StringView  message = "" 
)
static

Checks that a pointer is not null, failing if it's not the case.

Parameters
pThe pointer to check.
messageThe message to provide in case of a failure.

◆ areEqual() [3/5]

template<typename T = char*>
static void nkDebug::TestUtils::areEqual ( char *  a,
char *  b,
nkMemory::StringView  message = "" 
)
static

Template specialization for const char*.

Parameters
aFirst string to compare.
bSecond string to compare.
messageThe message to provide in case of a failure.

◆ areEqual() [4/5]

template<typename T = const char*>
static void nkDebug::TestUtils::areEqual ( const char *const &  a,
const char *const &  b,
nkMemory::StringView  message = "" 
)
static

Template specialization for const char*.

Parameters
aFirst string to compare.
bSecond string to compare.
messageThe message to provide in case of a failure.

◆ areNotEqual() [3/4]

template<typename T = char*>
static void nkDebug::TestUtils::areNotEqual ( char *  a,
char *  b,
nkMemory::StringView  message = "" 
)
static

Template specialization for const char*.

Parameters
aFirst string to compare.
bSecond string to compare.
messageThe message to provide in case of a failure.

◆ areNotEqual() [4/4]

template<typename T = const char*>
static void nkDebug::TestUtils::areNotEqual ( const char *const &  a,
const char *const &  b,
nkMemory::StringView  message = "" 
)
static

Template specialization for const char*.

Parameters
aFirst string to compare.
bSecond string to compare.
messageThe message to provide in case of a failure.

◆ areEqual() [5/5]

template<typename T = const char*>
static void nkDebug::TestUtils::areEqual ( const char *  a,
const char *  b,
const char *  precision,
nkMemory::StringView  message 
)
staticdelete

Template specialization for const char* comparison with precision (disabled).


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