-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathTest_Observer_Destruction.cpp
73 lines (54 loc) · 2.19 KB
/
Test_Observer_Destruction.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
#include <memory>
#include "CppUnitTest.h"
#include "Test_Base.hpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Nano_Tests
{
TEST_CLASS(Test_Observer_Destruction)
{
Signal_One mo_signal_one;
Signal_Two mo_signal_two;
public:
TEST_METHOD(Test_Stack_Foo_Observer_Destructor)
{
{
Foo to_foo;
mo_signal_one.connect<Foo, &Foo::slot_virtual_member_function>(to_foo);
mo_signal_two.connect<Foo, &Foo::slot_virtual_member_function>(&to_foo);
}
Assert::IsTrue(mo_signal_one.is_empty(), L"A slot was found.");
Assert::IsTrue(mo_signal_two.is_empty(), L"A slot was found.");
}
TEST_METHOD(Test_Stack_Bar_Foo_Observer_Destructor)
{
{
Bar to_bar;
mo_signal_one.connect<Bar, &Bar::slot_virtual_member_function>(&to_bar);
mo_signal_two.connect<Bar, &Bar::slot_virtual_member_function>(to_bar);
}
Assert::IsTrue(mo_signal_one.is_empty(), L"A slot was found.");
Assert::IsTrue(mo_signal_two.is_empty(), L"A slot was found.");
}
TEST_METHOD(Test_Heap_Foo_Observer_Destructor)
{
{
auto to_foo = std::make_unique<Foo>();
mo_signal_one.connect<Foo, &Foo::slot_virtual_member_function>(*to_foo);
mo_signal_two.connect<Foo, &Foo::slot_virtual_member_function>(*to_foo);
}
Assert::IsTrue(mo_signal_one.is_empty(), L"A slot was found.");
Assert::IsTrue(mo_signal_two.is_empty(), L"A slot was found.");
}
TEST_METHOD(Test_Heap_Bar_Foo_Observer_Destructor)
{
{
auto to_bar = std::make_unique<Bar>();
mo_signal_one.connect<Bar, &Bar::slot_virtual_member_function>(*to_bar);
mo_signal_two.connect<Bar, &Bar::slot_virtual_member_function>(*to_bar);
}
Assert::IsTrue(mo_signal_one.is_empty(), L"A slot was found.");
Assert::IsTrue(mo_signal_two.is_empty(), L"A slot was found.");
}
};
}