Commit 737a2d9a authored by Dominik Charousset's avatar Dominik Charousset

Remove "inflater" and "kr34t0r" tests

These two test cases are redundant and do not cover a case that is not already
tested elsewhere.
parent 497ad343
......@@ -650,87 +650,6 @@ CAF_TEST(sync_sends) {
}
#endif // CAF_WINDOWS
CAF_TEST(inflater) {
scoped_actor self;
struct inflater : public event_based_actor {
public:
inflater(string name, actor buddy)
: name_(std::move(name)),
buddy_(std::move(buddy)) {
inc_actor_instances();
}
~inflater() {
dec_actor_instances();
}
behavior make_behavior() override {
return {
[=](int n, const string& str) {
send(buddy_, n * 2, str + " from " + name_);
},
[=](ok_atom) {
quit();
}
};
}
private:
string name_;
actor buddy_;
};
auto joe = spawn<inflater>("Joe", self);
auto bob = spawn<inflater>("Bob", joe);
self->send(bob, 1, "hello actor");
self->receive (
[](int x, const std::string& y) {
CAF_CHECK_EQUAL(x, 4);
CAF_CHECK_EQUAL(y, "hello actor from Bob from Joe");
},
others >> [&] {
CAF_TEST_ERROR("Unexpected message: "
<< to_string(self->current_message()));
}
);
// kill joe and bob
auto ok_message = make_message(ok_atom::value);
anon_send(joe, ok_message);
anon_send(bob, ok_message);
}
CAF_TEST(kr34t0r) {
class kr34t0r : public event_based_actor {
public:
kr34t0r(string name, actor pal)
: name_(std::move(name)),
pal_(std::move(pal)) {
inc_actor_instances();
}
~kr34t0r() {
dec_actor_instances();
}
behavior make_behavior() override {
if (name_ == "Joe" && pal_ == invalid_actor) {
pal_ = spawn<kr34t0r>("Bob", this);
}
return {
others >> [=] {
// forward message and die
send(pal_, current_message());
quit();
}
};
}
void on_exit() override {
pal_ = invalid_actor; // break cycle
}
private:
string name_;
actor pal_;
};
scoped_actor self;
auto joe_the_second = spawn<kr34t0r>("Joe", invalid_actor);
self->send(joe_the_second, ok_atom::value);
}
CAF_TEST(function_spawn) {
scoped_actor self;
auto f = [](const string& name) -> behavior {
......
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