Reformat all files with clang-format

This commit is contained in:
Simon Giesecke
2020-01-26 10:09:20 +01:00
parent 47969cfdcf
commit b6c79eb0c8
13 changed files with 358 additions and 338 deletions

View File

@@ -9,15 +9,16 @@
static_assert(std::is_nothrow_swappable_v<zmq::poller_t<>>);
#endif
static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event<>), "");
static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event<zmq::no_user_data>), "");
static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event<zmq::
no_user_data>), "");
static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event<int>), "");
static_assert(alignof(zmq_poller_event_t) == alignof(zmq::poller_event<>), "");
static_assert(alignof(zmq_poller_event_t) == alignof(zmq::poller_event<int>), "");
static_assert(!std::is_copy_constructible<zmq::poller_t<>>::value,
"poller_t should not be copy-constructible");
"poller_t should not be copy-constructible");
static_assert(!std::is_copy_assignable<zmq::poller_t<>>::value,
"poller_t should not be copy-assignable");
"poller_t should not be copy-assignable");
TEST_CASE("event flags", "[poller]")
{
@@ -106,7 +107,9 @@ TEST_CASE("poller add handler invalid events type", "[poller]")
zmq::socket_t socket{context, zmq::socket_type::router};
zmq::poller_t<> poller;
short invalid_events_type = 2 << 10;
CHECK_THROWS_AS(poller.add(socket, static_cast<zmq::event_flags>(invalid_events_type)), const zmq::error_t&);
CHECK_THROWS_AS(
poller.add(socket, static_cast<zmq::event_flags>(invalid_events_type)),
const zmq::error_t&);
}
#endif
@@ -117,7 +120,8 @@ TEST_CASE("poller add handler twice throws", "[poller]")
zmq::poller_t<> poller;
poller.add(socket, zmq::event_flags::pollin);
/// \todo the actual error code should be checked
CHECK_THROWS_AS(poller.add(socket, zmq::event_flags::pollin), const zmq::error_t&);
CHECK_THROWS_AS(poller.add(socket, zmq::event_flags::pollin),
const zmq::error_t&);
}
TEST_CASE("poller wait with no handlers throws", "[poller]")
@@ -126,7 +130,7 @@ TEST_CASE("poller wait with no handlers throws", "[poller]")
std::vector<zmq::poller_event<>> events;
/// \todo the actual error code should be checked
CHECK_THROWS_AS(poller.wait_all(events, std::chrono::milliseconds{10}),
const zmq::error_t&);
const zmq::error_t&);
}
TEST_CASE("poller remove unregistered throws", "[poller]")
@@ -198,7 +202,8 @@ TEST_CASE("poller modify empty throws", "[poller]")
zmq::context_t context;
zmq::socket_t socket{context, zmq::socket_type::push};
zmq::poller_t<> poller;
CHECK_THROWS_AS(poller.modify(socket, zmq::event_flags::pollin), const zmq::error_t&);
CHECK_THROWS_AS(poller.modify(socket, zmq::event_flags::pollin),
const zmq::error_t&);
}
TEST_CASE("poller modify invalid socket throws", "[poller]")
@@ -226,7 +231,8 @@ TEST_CASE("poller modify simple", "[poller]")
zmq::socket_t a{context, zmq::socket_type::push};
zmq::poller_t<> poller;
CHECK_NOTHROW(poller.add(a, zmq::event_flags::pollin));
CHECK_NOTHROW(poller.modify(a, zmq::event_flags::pollin | zmq::event_flags::pollout));
CHECK_NOTHROW(
poller.modify(a, zmq::event_flags::pollin | zmq::event_flags::pollout));
}
TEST_CASE("poller poll client server", "[poller]")
@@ -247,9 +253,12 @@ TEST_CASE("poller poll client server", "[poller]")
CHECK(zmq::event_flags::pollin == events[0].events);
// Modify server socket with pollout flag
CHECK_NOTHROW(poller.modify(s.server, zmq::event_flags::pollin | zmq::event_flags::pollout));
CHECK_NOTHROW(
poller.modify(s.server, zmq::event_flags::pollin | zmq::event_flags::pollout
));
CHECK(1 == poller.wait_all(events, std::chrono::milliseconds{500}));
CHECK((zmq::event_flags::pollin | zmq::event_flags::pollout) == events[0].events);
CHECK((zmq::event_flags::pollin | zmq::event_flags::pollout) == events[0].events)
;
}
TEST_CASE("poller wait one return", "[poller]")
@@ -278,7 +287,8 @@ TEST_CASE("poller wait on move constructed", "[poller]")
zmq::poller_t<> b{std::move(a)};
std::vector<zmq::poller_event<>> events(1);
/// \todo the actual error code should be checked
CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}), const zmq::error_t&);
CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}),
const zmq::error_t&);
CHECK(1 == b.wait_all(events, std::chrono::milliseconds{-1}));
}
@@ -292,7 +302,8 @@ TEST_CASE("poller wait on move assigned", "[poller]")
b = {std::move(a)};
/// \todo the TEST_CASE error code should be checked
std::vector<zmq::poller_event<>> events(1);
CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}), const zmq::error_t&);
CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}),
const zmq::error_t&);
CHECK(1 == b.wait_all(events, std::chrono::milliseconds{-1}));
}