Problem: Dependency on googletest framework

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.
This commit is contained in:
Pawel Kurdybacha
2018-09-23 17:14:25 +01:00
parent 5af24314c3
commit ae15964907
18 changed files with 332 additions and 389 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include <gtest/gtest.h>
#include <catch.hpp>
#include <zmq.hpp>
#if defined(ZMQ_CPP11)
@@ -18,12 +18,12 @@ class loopback_ip4_binder
// and constructor/destructor are not.
void bind(zmq::socket_t &socket)
{
ASSERT_NO_THROW(socket.bind("tcp://127.0.0.1:*"));
REQUIRE_NOTHROW(socket.bind("tcp://127.0.0.1:*"));
std::array<char, 100> endpoint{};
size_t endpoint_size = endpoint.size();
ASSERT_NO_THROW(
REQUIRE_NOTHROW(
socket.getsockopt(ZMQ_LAST_ENDPOINT, endpoint.data(), &endpoint_size));
ASSERT_TRUE(endpoint_size < endpoint.size());
REQUIRE(endpoint_size < endpoint.size());
endpoint_ = std::string{endpoint.data()};
}
std::string endpoint_;
@@ -40,7 +40,7 @@ struct common_server_client_setup
void init()
{
endpoint = loopback_ip4_binder{server}.endpoint();
ASSERT_NO_THROW(client.connect(endpoint));
REQUIRE_NOTHROW(client.connect(endpoint));
}
zmq::context_t context;