aboutsummaryrefslogtreecommitdiff
path: root/test/util.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-02 15:55:58 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-02 15:55:58 +0100
commit5e4dd0c0197f6273c61491a5b9a030c93f796a12 (patch)
tree390fc6d980cc49927523befb43d189c608452276 /test/util.cpp
parent369e3d71aa79783d95166739cfa93a480defe6ea (diff)
add some tests
Diffstat (limited to 'test/util.cpp')
-rw-r--r--test/util.cpp15
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);
+}
+