Solution: Add `zmq::sockopt::socket_type` that is used to `get()` an enumerator
from `zmq::socket_type` instead of plain `int`.
It makes code like this compile:
#include <zmq.hpp>
#include <cassert>
int main()
{
zmq::context_t ctx;
zmq::socket_t sock(ctx, zmq::socket_type::push);
assert(sock.get(zmq::sockopt::socket_type) == zmq::socket_type::push);
return 0;
}
Solution: Implement a type for each socket option.
Each option has an associated type, therefore they
can't be simply defined as an enum class.
Use new sockopt getter in test util
Add socket option get function for strings and tests
Solution: Implement for socket_t, context_t, message_t and poller_t
Additionally remove dependency on <functional> by refactoring poller_t
and remove unused <unordered_map> include.
Currently cppzmq as relatively simple and header only library depends on rather
complex unit test framework googletest.
Current issues:
- Googletest requires downloading and building it every time on travis
as cache support is limited there
- Googletest build is signifficant with comparison to cppzmq unittests
total runtime
Solution: Port existing tests to Catch - header only C++ framework and
gain ~20% build speed up on travis.
Why Catch?
It is well know C++ header only testing framework. It works well, it is
being kept up to date and maintainers seem to pay attention to
community's comments and issues.
We can not use Catch2 currently as we still support pre-C++11 compilers.
For header only library like cppzmq, whitespace style inherited from
libzmq is too restrictive.
Solution: relaxing whitespace before parens from always to in control
statements only, increased max column width from 80 to 85 and removing
requirement of whitespace after template keyword.