mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-04 05:59:22 +00:00
Fix compilation errors with gcc in shared_ptr_unittest.cpp.
This commit is contained in:
parent
d19e7875e1
commit
9ed888b82b
@ -37,17 +37,18 @@ TEST(SharedPtr, RefCount)
|
||||
EXPECT_EQ(1, b.getRefCount());
|
||||
}
|
||||
|
||||
|
||||
class DeleteIsCalled
|
||||
{
|
||||
public:
|
||||
DeleteIsCalled(bool& flag) : m_flag(flag) { }
|
||||
~DeleteIsCalled() { m_flag = true; }
|
||||
private:
|
||||
bool& m_flag;
|
||||
};
|
||||
|
||||
TEST(SharedPtr, DeleteIsCalled)
|
||||
{
|
||||
class DeleteIsCalled
|
||||
{
|
||||
public:
|
||||
DeleteIsCalled(bool& flag) : m_flag(flag) { }
|
||||
~DeleteIsCalled() { m_flag = true; }
|
||||
private:
|
||||
bool& m_flag;
|
||||
};
|
||||
|
||||
bool flag = false;
|
||||
{
|
||||
SharedPtr<DeleteIsCalled> a(new DeleteIsCalled(flag));
|
||||
@ -55,10 +56,12 @@ TEST(SharedPtr, DeleteIsCalled)
|
||||
EXPECT_EQ(true, flag);
|
||||
}
|
||||
|
||||
|
||||
class A { };
|
||||
class B : public A { };
|
||||
|
||||
TEST(SharedPtr, Hierarchy)
|
||||
{
|
||||
class A { };
|
||||
class B : public A { };
|
||||
SharedPtr<A> a(new B);
|
||||
SharedPtr<B> b = a;
|
||||
SharedPtr<A> c = a;
|
||||
@ -66,6 +69,7 @@ TEST(SharedPtr, Hierarchy)
|
||||
EXPECT_EQ(4, a.getRefCount());
|
||||
}
|
||||
|
||||
|
||||
TEST(SharedPtr, Compare)
|
||||
{
|
||||
SharedPtr<int> a(new int(0));
|
||||
|
Loading…
Reference in New Issue
Block a user