diff options
author | Jack Lloyd <[email protected]> | 2018-01-30 05:15:49 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-01-30 05:15:49 -0500 |
commit | b0d23786bee4cc97510a5fe223ce1a4b2959a921 (patch) | |
tree | 582503e0840de4fe4a6c77bd5a3c1c8253d7827d | |
parent | 38a8939f9cf04bf5a76c270d99fe922cde152ff5 (diff) |
Add test for non-null pointer
-rw-r--r-- | src/tests/tests.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tests/tests.h b/src/tests/tests.h index 36a6d4862..fa5dc34b6 100644 --- a/src/tests/tests.h +++ b/src/tests/tests.h @@ -192,6 +192,15 @@ class Test } } + template<typename T> + bool test_not_null(const std::string& what, T* ptr) + { + if(ptr == nullptr) + return test_failure(what + " was null"); + else + return test_success(what + " was not null"); + } + bool test_eq(const std::string& what, const char* produced, const char* expected); bool test_is_nonempty(const std::string& what_is_it, const std::string& to_examine); |