Commit b9388f29 authored by Dominik Charousset's avatar Dominik Charousset

Re-implement unit test for local groups

parent 62767a6b
...@@ -23,9 +23,12 @@ using namespace cppa; ...@@ -23,9 +23,12 @@ using namespace cppa;
void testee(event_based_actor* self, int current_value, int final_result) { void testee(event_based_actor* self, int current_value, int final_result) {
self->become( self->become(
on_arg_match >> [=](int result) { [=](int result) {
auto next = result + current_value; auto next = result + current_value;
if (next >= final_result) self->quit(); if (next >= final_result) {
CPPA_CHECKPOINT();
self->quit();
}
else testee(self, next, final_result); else testee(self, next, final_result);
}, },
after(std::chrono::seconds(2)) >> [=] { after(std::chrono::seconds(2)) >> [=] {
...@@ -35,23 +38,26 @@ void testee(event_based_actor* self, int current_value, int final_result) { ...@@ -35,23 +38,26 @@ void testee(event_based_actor* self, int current_value, int final_result) {
); );
} }
int main() { void test_local_group() {
CPPA_TEST(test_local_group); scoped_actor self;
/*
auto foo_group = group::get("local", "foo"); auto foo_group = group::get("local", "foo");
auto master = spawn_in_group(foo_group, testee, 0, 10); auto master = spawn_in_group(foo_group, testee, 0, 10);
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
// spawn five workers and let them join local/foo // spawn five workers and let them join local/foo
spawn_in_group(foo_group, [master] { self->spawn_in_group(foo_group, [master](event_based_actor* m) {
become(on_arg_match >> [master](int v) { m->become([master, m](int v) {
send(master, v); m->send(master, v);
self->quit(); m->quit();
}); });
}); });
} }
send(foo_group, 2); self->send(foo_group, 2);
}
int main() {
CPPA_TEST(test_local_group);
test_local_group();
await_all_actors_done(); await_all_actors_done();
shutdown(); shutdown();
*/
return CPPA_TEST_RESULT(); return CPPA_TEST_RESULT();
} }
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