blob: ba955c5600213337ca4a2ea9a9dd4a04e0fbfdaa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
}
|