Commit 467f3367 authored by neverlord's avatar neverlord

added echo_actor to spawn unit test

parent b36cae49
...@@ -294,6 +294,17 @@ void testee3(actor_ptr parent) ...@@ -294,6 +294,17 @@ void testee3(actor_ptr parent)
); );
} }
void echo_actor()
{
receive
(
others() >> []()
{
self->last_sender() << self->last_dequeued();
}
);
}
template<class Testee> template<class Testee>
std::string behavior_test(actor_ptr et) std::string behavior_test(actor_ptr et)
{ {
...@@ -343,6 +354,13 @@ size_t test__spawn() ...@@ -343,6 +354,13 @@ size_t test__spawn()
receive(after(std::chrono::seconds(1)) >> []() { }); receive(after(std::chrono::seconds(1)) >> []() { });
CPPA_IF_VERBOSE(cout << "ok" << endl); CPPA_IF_VERBOSE(cout << "ok" << endl);
CPPA_IF_VERBOSE(cout << "test echo actor ... " << std::flush);
auto mecho = spawn(echo_actor);
send(mecho, "hello echo");
receive(on("hello echo") >> []() { });
await_all_others_done();
CPPA_IF_VERBOSE(cout << "ok" << endl);
CPPA_IF_VERBOSE(cout << "testee1 ... " << std::flush); CPPA_IF_VERBOSE(cout << "testee1 ... " << std::flush);
spawn(testee1); spawn(testee1);
await_all_others_done(); await_all_others_done();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment