diff options
Diffstat (limited to 'test/util.cpp')
-rw-r--r-- | test/util.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/util.cpp b/test/util.cpp new file mode 100644 index 0000000..e90882a --- /dev/null +++ b/test/util.cpp @@ -0,0 +1,15 @@ +#include <gtest/gtest.h> + +#include "backend/util.h" + +TEST(Util, SafeFree) { + char * str = static_cast<char *>(malloc(3)); + ASSERT_NE(str, nullptr); + + safe_free(&str); + ASSERT_EQ(str, nullptr); + + // this shouldn't cause double free() error: + safe_free(&str); +} + |