Problem: test cases for error behaviour of (active_)poller_t failing with libzmq 4.3.x

Solution: adapt test cases to changed behaviour
This commit is contained in:
Simon Giesecke 2019-02-04 14:53:03 +01:00
parent c5fe9d1c27
commit 4043617afe
2 changed files with 10 additions and 10 deletions

View File

@ -83,20 +83,20 @@ TEST_CASE("add handler", "[active_poller]")
CHECK_NOTHROW(active_poller.add(socket, ZMQ_POLLIN, handler));
}
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 0)
// this behaviour was added by https://github.com/zeromq/libzmq/pull/3100
TEST_CASE("add handler invalid events type", "[active_poller]")
{
/// \todo is it good that this is accepted? should probably already be
/// checked by zmq_poller_add/modify in libzmq:
/// https://github.com/zeromq/libzmq/issues/3088
zmq::context_t context;
zmq::socket_t socket{context, zmq::socket_type::router};
zmq::active_poller_t active_poller;
zmq::active_poller_t::handler_t handler;
short invalid_events_type = 2 << 10;
CHECK_NOTHROW(active_poller.add(socket, invalid_events_type, handler));
CHECK_FALSE(active_poller.empty());
CHECK(1u == active_poller.size());
CHECK_THROWS_AS(active_poller.add(socket, invalid_events_type, handler), zmq::error_t);
CHECK(active_poller.empty());
CHECK(0u == active_poller.size());
}
#endif
TEST_CASE("add handler twice throws", "[active_poller]")
{

View File

@ -66,17 +66,17 @@ TEST_CASE("poller add non nullptr", "[poller]")
CHECK_NOTHROW(poller.add(socket, ZMQ_POLLIN, &i));
}
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 0)
// this behaviour was added by https://github.com/zeromq/libzmq/pull/3100
TEST_CASE("poller add handler invalid events type", "[poller]")
{
/// \todo is it good that this is accepted? should probably already be
/// checked by zmq_poller_add/modify in libzmq:
/// https://github.com/zeromq/libzmq/issues/3088
zmq::context_t context;
zmq::socket_t socket{context, zmq::socket_type::router};
zmq::poller_t<> poller;
short invalid_events_type = 2 << 10;
CHECK_NOTHROW(poller.add(socket, invalid_events_type, nullptr));
CHECK_THROWS_AS(poller.add(socket, invalid_events_type, nullptr), zmq::error_t);
}
#endif
TEST_CASE("poller add handler twice throws", "[poller]")
{