aboutsummaryrefslogtreecommitdiff
path: root/test/ptrlist.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/ptrlist.cpp
parent369e3d71aa79783d95166739cfa93a480defe6ea (diff)
add some tests
Diffstat (limited to 'test/ptrlist.cpp')
-rw-r--r--test/ptrlist.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ptrlist.cpp b/test/ptrlist.cpp
new file mode 100644
index 0000000..ba955c5
--- /dev/null
+++ b/test/ptrlist.cpp
@@ -0,0 +1,27 @@
+#include <gtest/gtest.h>
+
+#include "backend/PtrList.h"
+
+class FooBar {
+ int val = 3;
+ bool other = 4;
+};
+
+TEST(PtrListTest, FreePointers) {
+ // PtrList only works on classes:
+ FooBar * ptr1 = new FooBar();
+ FooBar * ptr2 = new FooBar();
+
+ {
+ PtrList<FooBar> foo;
+
+ foo.push_back(ptr1);
+ foo.push_back(ptr2);
+
+ // this destructor SHOULD free ptr1 and ptr2
+ }
+
+ ASSERT_NE(ptr1, nullptr);
+ ASSERT_NE(ptr2, nullptr);
+}
+