|
@@ -75,23 +75,15 @@ class ListenerListTests : public UnitTest |
|
|
public:
|
|
|
public:
|
|
|
ListenerListTests() : UnitTest ("ListenerList") {}
|
|
|
ListenerListTests() : UnitTest ("ListenerList") {}
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
|
void callHelper (std::vector<int>& expectedCounterValues, T v)
|
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
|
|
void callHelper (std::vector<int>& expectedCounterValues)
|
|
|
{
|
|
|
{
|
|
|
counter = 0;
|
|
|
|
|
|
listeners.call (&ListenerBase::f, v);
|
|
|
|
|
|
expect (counter == expectedCounterValues[1]);
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
counter = 0;
|
|
|
listeners.call (&ListenerBase::f);
|
|
|
listeners.call (&ListenerBase::f);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
|
|
|
|
|
|
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
|
|
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
|
|
|
listeners.callChecked (boc, &ListenerBase::f, v);
|
|
|
|
|
|
expect (counter == expectedCounterValues[1]);
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
counter = 0;
|
|
|
listeners.callChecked (boc, &ListenerBase::f);
|
|
|
listeners.callChecked (boc, &ListenerBase::f);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
@@ -114,24 +106,16 @@ public: |
|
|
callHelper (expectedCounterValues, args...);
|
|
|
callHelper (expectedCounterValues, args...);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
void callExcludingHelper (ListenerBase& listenerToExclude,
|
|
|
void callExcludingHelper (ListenerBase& listenerToExclude,
|
|
|
std::vector<int>& expectedCounterValues, T v)
|
|
|
|
|
|
|
|
|
std::vector<int>& expectedCounterValues)
|
|
|
{
|
|
|
{
|
|
|
counter = 0;
|
|
|
|
|
|
listeners.callExcluding (listenerToExclude, &ListenerBase::f, v);
|
|
|
|
|
|
expect (counter == expectedCounterValues[1]);
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
counter = 0;
|
|
|
listeners.callExcluding (listenerToExclude, &ListenerBase::f);
|
|
|
listeners.callExcluding (listenerToExclude, &ListenerBase::f);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
|
|
|
|
|
|
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
|
|
ListenerList<ListenerBase>::DummyBailOutChecker boc;
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
|
|
|
listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f, v);
|
|
|
|
|
|
expect (counter == expectedCounterValues[1]);
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
counter = 0;
|
|
|
listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f);
|
|
|
listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|
expect (counter == expectedCounterValues[0]);
|
|
|