Commit a075cee3 authored by Dominik Charousset's avatar Dominik Charousset

Apply clang-format to dsl.hpp

parent 73e3848f
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
CAF_PUSH_WARNINGS CAF_PUSH_WARNINGS
/// The type of `_`. /// The type of `_`.
struct wildcard { }; struct wildcard {};
/// Allows ignoring individual messages elements in `expect` clauses, e.g. /// Allows ignoring individual messages elements in `expect` clauses, e.g.
/// `expect((int, int), from(foo).to(bar).with(1, _))`. /// `expect((int, int), from(foo).to(bar).with(1, _))`.
...@@ -76,7 +76,7 @@ bool operator==(const message& x, const T& y) { ...@@ -76,7 +76,7 @@ bool operator==(const message& x, const T& y) {
} // namespace caf } // namespace caf
// dummy function to force ADL later on // dummy function to force ADL later on
//int inspect(int, int); // int inspect(int, int);
template <class T> template <class T>
struct has_outer_type { struct has_outer_type {
...@@ -123,19 +123,13 @@ private: ...@@ -123,19 +123,13 @@ private:
} }
template <size_t X, class T, class... Ts> template <size_t X, class T, class... Ts>
typename std::enable_if< typename std::enable_if<caf::meta::is_annotation<T>::value, bool>::type
caf::meta::is_annotation<T>::value,
bool
>::type
iterate(pos<X> pos, const T&, const Ts&... ys) { iterate(pos<X> pos, const T&, const Ts&... ys) {
return iterate(pos, ys...); return iterate(pos, ys...);
} }
template <size_t X, class T, class... Ts> template <size_t X, class T, class... Ts>
typename std::enable_if< typename std::enable_if<!caf::meta::is_annotation<T>::value, bool>::type
!caf::meta::is_annotation<T>::value,
bool
>::type
iterate(pos<X>, const T& y, const Ts&... ys) { iterate(pos<X>, const T& y, const Ts&... ys) {
std::integral_constant<size_t, X + 1> next; std::integral_constant<size_t, X + 1> next;
check(y, get<X>(xs_)); check(y, get<X>(xs_));
...@@ -286,8 +280,8 @@ std::tuple<T, Ts...> extract(caf_handle x) { ...@@ -286,8 +280,8 @@ std::tuple<T, Ts...> extract(caf_handle x) {
auto ptr = x->peek_at_next_mailbox_element(); auto ptr = x->peek_at_next_mailbox_element();
if (ptr == nullptr) if (ptr == nullptr)
CAF_FAIL("Mailbox is empty"); CAF_FAIL("Mailbox is empty");
CAF_FAIL("Message does not match expected pattern: " CAF_FAIL(
<< to_string(ptr->content())); "Message does not match expected pattern: " << to_string(ptr->content()));
} }
return std::move(*result); return std::move(*result);
} }
...@@ -301,8 +295,7 @@ template <class... Ts> ...@@ -301,8 +295,7 @@ template <class... Ts>
class expect_clause { class expect_clause {
public: public:
expect_clause(caf::scheduler::test_coordinator& sched) expect_clause(caf::scheduler::test_coordinator& sched)
: sched_(sched), : sched_(sched), dest_(nullptr) {
dest_(nullptr) {
peek_ = [=] { peek_ = [=] {
/// The extractor will call CAF_FAIL on a type mismatch, essentially /// The extractor will call CAF_FAIL on a type mismatch, essentially
/// performing a type check when ignoring the result. /// performing a type check when ignoring the result.
...@@ -350,7 +343,7 @@ public: ...@@ -350,7 +343,7 @@ public:
// TODO: replace this workaround with the make_tuple() line when dropping // TODO: replace this workaround with the make_tuple() line when dropping
// support for GCC 4.8. // support for GCC 4.8.
std::tuple<typename std::decay<Us>::type...> tmp{std::forward<Us>(xs)...}; std::tuple<typename std::decay<Us>::type...> tmp{std::forward<Us>(xs)...};
//auto tmp = std::make_tuple(std::forward<Us>(xs)...); // auto tmp = std::make_tuple(std::forward<Us>(xs)...);
// TODO: move tmp into lambda when switching to C++14 // TODO: move tmp into lambda when switching to C++14
peek_ = [=] { peek_ = [=] {
using namespace caf::detail; using namespace caf::detail;
...@@ -373,7 +366,7 @@ protected: ...@@ -373,7 +366,7 @@ protected:
caf::scheduler::test_coordinator& sched_; caf::scheduler::test_coordinator& sched_;
caf::strong_actor_ptr src_; caf::strong_actor_ptr src_;
caf::abstract_actor* dest_; caf::abstract_actor* dest_;
std::function<void ()> peek_; std::function<void()> peek_;
}; };
template <> template <>
...@@ -504,8 +497,7 @@ template <class... Ts> ...@@ -504,8 +497,7 @@ template <class... Ts>
class allow_clause { class allow_clause {
public: public:
allow_clause(caf::scheduler::test_coordinator& sched) allow_clause(caf::scheduler::test_coordinator& sched)
: sched_(sched), : sched_(sched), dest_(nullptr) {
dest_(nullptr) {
peek_ = [=] { peek_ = [=] {
if (dest_ != nullptr) if (dest_ != nullptr)
return try_extract<Ts...>(dest_) != caf::none; return try_extract<Ts...>(dest_) != caf::none;
...@@ -581,7 +573,7 @@ protected: ...@@ -581,7 +573,7 @@ protected:
caf::scheduler::test_coordinator& sched_; caf::scheduler::test_coordinator& sched_;
caf::strong_actor_ptr src_; caf::strong_actor_ptr src_;
caf::abstract_actor* dest_; caf::abstract_actor* dest_;
std::function<bool ()> peek_; std::function<bool()> peek_;
}; };
template <class... Ts> template <class... Ts>
...@@ -648,7 +640,7 @@ public: ...@@ -648,7 +640,7 @@ public:
protected: protected:
caf_handle src_; caf_handle src_;
caf_handle dest_; caf_handle dest_;
std::function<void ()> check_; std::function<void()> check_;
}; };
template <class... Ts> template <class... Ts>
...@@ -657,9 +649,10 @@ struct test_coordinator_fixture_fetch_helper { ...@@ -657,9 +649,10 @@ struct test_coordinator_fixture_fetch_helper {
std::tuple<Ts...> std::tuple<Ts...>
operator()(caf::response_handle<Self, Interface, true>& from) const { operator()(caf::response_handle<Self, Interface, true>& from) const {
std::tuple<Ts...> result; std::tuple<Ts...> result;
from.receive( from.receive([&](Ts&... xs) { result = std::make_tuple(std::move(xs)...); },
[&](Ts&... xs) { result = std::make_tuple(std::move(xs)...); }, [&](caf::error& err) {
[&](caf::error& err) { FAIL(from.self()->system().render(err)); }); FAIL(from.self()->system().render(err));
});
return result; return result;
} }
}; };
...@@ -669,9 +662,10 @@ struct test_coordinator_fixture_fetch_helper<T> { ...@@ -669,9 +662,10 @@ struct test_coordinator_fixture_fetch_helper<T> {
template <class Self, class Interface> template <class Self, class Interface>
T operator()(caf::response_handle<Self, Interface, true>& from) const { T operator()(caf::response_handle<Self, Interface, true>& from) const {
T result; T result;
from.receive( from.receive([&](T& x) { result = std::move(x); },
[&](T& x) { result = std::move(x); }, [&](caf::error& err) {
[&](caf::error& err) { FAIL(from.self()->system().render(err)); }); FAIL(from.self()->system().render(err));
});
return result; return 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