forked from NoAvailableAlias/nano-signal-slot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test_ST_Policy.cpp
64 lines (44 loc) · 1.48 KB
/
Test_ST_Policy.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
#include <list>
#include "CppUnitTest.h"
#include "Test_Base.hpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Nano_Tests
{
TEST_CLASS(Test_ST_Policy)
{
const int N = 64;
using Moo_T = Moo<Observer_ST>;
using Subject = Signal_Rng_ST;
TEST_METHOD(Test_Global_Signal)
{
Subject subject;
std::size_t count = 0;
Rng rng;
for (; count < N; ++count)
{
std::list<Moo_T> moo(N);
for (auto& moo_instance : moo)
{
subject.connect<&Moo_T::slot_next_random>(moo_instance);
}
subject.fire(rng);
}
Assert::IsTrue(subject.is_empty(), L"A signal was found not empty.");
}
//----------------------------------------------------------------------
//TEST_METHOD(Test_Signal_Move)
//{
// Moo_T foo;
// Subject* signal_one = new Subject();
// signal_one->connect<&Moo_T::slot_next_random>(foo);
// {
// Subject signal_two = std::move(*signal_one);
// Assert::IsTrue(signal_one->is_empty(), L"Signal failed to sink.");
// delete signal_one;
// signal_two.fire(Rng());
// foo.disconnect_all();
// }
// Assert::IsTrue(foo.is_empty(), L"Signal failed to sink.");
//}
};
}