Skip to content

Commit

Permalink
Adding a Deferred output-only AutoFilter
Browse files Browse the repository at this point in the history
This test case seems to throw a bad_weak_ptr exception, potentially due to invalid setup operations occuring inside of ObjectPool
  • Loading branch information
codemercenary committed Jul 31, 2014
1 parent fb55296 commit 92fa343
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/autowiring/test/AutoFilterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,3 +1072,29 @@ TEST_F(AutoFilterTest, WaitWhilePacketOutstanding) {
packet.reset();
ASSERT_TRUE(ctxt->Wait(std::chrono::milliseconds(1))) << "Wait incorrectly timed out when nothing should have been running";
}

class DecoratesAndAcceptsNothing:
public CoreThread
{
public:
Deferred AutoFilter(Decoration<0>& dec) {
dec.i = 105;
return Deferred(this);
}
};

TEST_F(AutoFilterTest, DeferredDecorateOnly) {
AutoCurrentContext ctxt;
AutoRequired<DecoratesAndAcceptsNothing> daan;
AutoRequired<AutoPacketFactory> factory;

ctxt->Initiate();
auto packet = factory->NewPacket();

ctxt->SignalShutdown();
ASSERT_TRUE(daan->WaitFor(std::chrono::seconds(5)));

const Decoration<0>* dec;
ASSERT_TRUE(packet->Get(dec)) << "Deferred decorator didn't attach a decoration to an issued packet";
ASSERT_EQ(105, dec->i) << "Deferred decorate-only AutoFilter did not properly attach before context termination";
}

0 comments on commit 92fa343

Please sign in to comment.