Utilities to write tests.
More...
|
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 |
|
Utilities to write tests.
◆ check()
Allows to check a condition and fail if it resolves to false.
- Parameters
-
condition | The condition to check for. |
message | The 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
-
a | The a member of the equality check. |
b | The b member of the equality check. |
message | The 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 |
( |
T |
a, |
|
|
T |
b, |
|
|
T |
precision, |
|
|
nkMemory::StringView |
message = "" |
|
) |
| |
|
static |
Checks that two objects are equal, failing if it's not the case.
- Parameters
-
a | The a member of the equality check. |
b | The b member of the equality check. |
precision | The 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). |
message | The 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
-
a | The a member of the equality check. |
b | The b member of the equality check. |
message | The 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 |
( |
T |
a, |
|
|
T |
b, |
|
|
T |
precision, |
|
|
nkMemory::StringView |
message = "" |
|
) |
| |
|
static |
Checks that two objects are not equal, failing if it's not the case.
- Parameters
-
a | The a member of the equality check. |
b | The b member of the equality check. |
precision | The 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). |
message | The message to provide in case of a failure. |
◆ isNull()
Checks that a pointer is null, failing if it's not the case.
- Parameters
-
p | The pointer to check. |
message | The message to provide in case of a failure. |
◆ isNotNull()
Checks that a pointer is not null, failing if it's not the case.
- Parameters
-
p | The pointer to check. |
message | The message to provide in case of a failure. |
◆ areEqual() [3/5]
template<typename T = char*>
Template specialization for const char*.
- Parameters
-
a | First string to compare. |
b | Second string to compare. |
message | The 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
-
a | First string to compare. |
b | Second string to compare. |
message | The 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
-
a | First string to compare. |
b | Second string to compare. |
message | The 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
-
a | First string to compare. |
b | Second string to compare. |
message | The 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: