diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-02 15:55:58 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-02 15:55:58 +0100 |
commit | 5e4dd0c0197f6273c61491a5b9a030c93f796a12 (patch) | |
tree | 390fc6d980cc49927523befb43d189c608452276 /test/util.cpp | |
parent | 369e3d71aa79783d95166739cfa93a480defe6ea (diff) |
add some tests
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); +} + |