Problem: whitespace style too restrictive.

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.
This commit is contained in:
Pawel Kurdybacha
2018-05-12 17:28:28 +01:00
parent 590cf711e5
commit ff3c221516
12 changed files with 932 additions and 993 deletions

View File

@@ -2,119 +2,119 @@
#include <zmq.hpp>
#if defined(ZMQ_CPP11)
static_assert (!std::is_copy_constructible<zmq::message_t>::value,
"message_t should not be copy-constructible");
static_assert (!std::is_copy_assignable<zmq::message_t>::value,
"message_t should not be copy-assignable");
static_assert(!std::is_copy_constructible<zmq::message_t>::value,
"message_t should not be copy-constructible");
static_assert(!std::is_copy_assignable<zmq::message_t>::value,
"message_t should not be copy-assignable");
#endif
TEST (message, constructor_default)
TEST(message, constructor_default)
{
const zmq::message_t message;
ASSERT_EQ (0u, message.size ());
ASSERT_EQ(0u, message.size());
}
const char *const data = "Hi";
TEST (message, constructor_iterators)
TEST(message, constructor_iterators)
{
const std::string hi (data);
const zmq::message_t hi_msg (hi.begin (), hi.end ());
ASSERT_EQ (2u, hi_msg.size ());
ASSERT_EQ (0, memcmp (data, hi_msg.data (), 2));
const std::string hi(data);
const zmq::message_t hi_msg(hi.begin(), hi.end());
ASSERT_EQ(2u, hi_msg.size());
ASSERT_EQ(0, memcmp(data, hi_msg.data(), 2));
}
TEST (message, constructor_pointer_size)
TEST(message, constructor_pointer_size)
{
const std::string hi (data);
const zmq::message_t hi_msg (hi.data (), hi.size ());
ASSERT_EQ (2u, hi_msg.size ());
ASSERT_EQ (0, memcmp (data, hi_msg.data (), 2));
const std::string hi(data);
const zmq::message_t hi_msg(hi.data(), hi.size());
ASSERT_EQ(2u, hi_msg.size());
ASSERT_EQ(0, memcmp(data, hi_msg.data(), 2));
}
TEST (message, constructor_char_array)
TEST(message, constructor_char_array)
{
const zmq::message_t hi_msg (data, strlen (data));
ASSERT_EQ (2u, hi_msg.size ());
ASSERT_EQ (0, memcmp (data, hi_msg.data (), 2));
const zmq::message_t hi_msg(data, strlen(data));
ASSERT_EQ(2u, hi_msg.size());
ASSERT_EQ(0, memcmp(data, hi_msg.data(), 2));
}
#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11)
TEST (message, constructor_container)
TEST(message, constructor_container)
{
const std::string hi (data);
zmq::message_t hi_msg (hi);
ASSERT_EQ (2u, hi_msg.size ());
ASSERT_EQ (0, memcmp (data, hi_msg.data (), 2));
const std::string hi(data);
zmq::message_t hi_msg(hi);
ASSERT_EQ(2u, hi_msg.size());
ASSERT_EQ(0, memcmp(data, hi_msg.data(), 2));
}
#endif
#ifdef ZMQ_HAS_RVALUE_REFS
TEST (message, constructor_move)
TEST(message, constructor_move)
{
zmq::message_t hi_msg (zmq::message_t (data, strlen (data)));
zmq::message_t hi_msg(zmq::message_t(data, strlen(data)));
}
TEST (message, assign_move_empty_before)
TEST(message, assign_move_empty_before)
{
zmq::message_t hi_msg;
hi_msg = zmq::message_t (data, strlen (data));
ASSERT_EQ (2u, hi_msg.size ());
ASSERT_EQ (0, memcmp (data, hi_msg.data (), 2));
hi_msg = zmq::message_t(data, strlen(data));
ASSERT_EQ(2u, hi_msg.size());
ASSERT_EQ(0, memcmp(data, hi_msg.data(), 2));
}
TEST (message, assign_move_empty_after)
TEST(message, assign_move_empty_after)
{
zmq::message_t hi_msg (data, strlen (data));
hi_msg = zmq::message_t ();
ASSERT_EQ (0u, hi_msg.size ());
zmq::message_t hi_msg(data, strlen(data));
hi_msg = zmq::message_t();
ASSERT_EQ(0u, hi_msg.size());
}
TEST (message, assign_move_empty_before_and_after)
TEST(message, assign_move_empty_before_and_after)
{
zmq::message_t hi_msg;
hi_msg = zmq::message_t ();
ASSERT_EQ (0u, hi_msg.size ());
hi_msg = zmq::message_t();
ASSERT_EQ(0u, hi_msg.size());
}
#endif
TEST (message, equality_self)
TEST(message, equality_self)
{
const zmq::message_t hi_msg (data, strlen (data));
ASSERT_EQ (hi_msg, hi_msg);
const zmq::message_t hi_msg(data, strlen(data));
ASSERT_EQ(hi_msg, hi_msg);
}
TEST (message, equality_equal)
TEST(message, equality_equal)
{
const zmq::message_t hi_msg_a (data, strlen (data));
const zmq::message_t hi_msg_b (data, strlen (data));
ASSERT_EQ (hi_msg_a, hi_msg_b);
const zmq::message_t hi_msg_a(data, strlen(data));
const zmq::message_t hi_msg_b(data, strlen(data));
ASSERT_EQ(hi_msg_a, hi_msg_b);
}
TEST (message, equality_equal_empty)
TEST(message, equality_equal_empty)
{
const zmq::message_t msg_a;
const zmq::message_t msg_b;
ASSERT_EQ (msg_a, msg_b);
ASSERT_EQ(msg_a, msg_b);
}
TEST (message, equality_non_equal)
TEST(message, equality_non_equal)
{
const zmq::message_t msg_a ("Hi", 2);
const zmq::message_t msg_b ("Hello", 5);
ASSERT_NE (msg_a, msg_b);
const zmq::message_t msg_a("Hi", 2);
const zmq::message_t msg_b("Hello", 5);
ASSERT_NE(msg_a, msg_b);
}
TEST (message, equality_non_equal_rhs_empty)
TEST(message, equality_non_equal_rhs_empty)
{
const zmq::message_t msg_a ("Hi", 2);
const zmq::message_t msg_a("Hi", 2);
const zmq::message_t msg_b;
ASSERT_NE (msg_a, msg_b);
ASSERT_NE(msg_a, msg_b);
}
TEST (message, equality_non_equal_lhs_empty)
TEST(message, equality_non_equal_lhs_empty)
{
const zmq::message_t msg_a;
const zmq::message_t msg_b ("Hi", 2);
ASSERT_NE (msg_a, msg_b);
const zmq::message_t msg_b("Hi", 2);
ASSERT_NE(msg_a, msg_b);
}