From 46a48fb62c93eeb4559c02e840d51f36e9eda186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Korina=20=C5=A0imi=C4=8Devi=C4=87?= Date: Thu, 1 Feb 2024 13:10:09 +0100 Subject: [PATCH] Fix Win32 build Summary: related to T11798 Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Differential Revision: https://repo.mireo.local/D27668 --- test/include/test_common/test_broker.hpp | 2 -- test/integration/receive_publish.cpp | 29 ++++++++++++------------ test/integration/send_publish.cpp | 2 +- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/test/include/test_common/test_broker.hpp b/test/include/test_common/test_broker.hpp index 9bcad2a..8062076 100644 --- a/test/include/test_common/test_broker.hpp +++ b/test/include/test_common/test_broker.hpp @@ -162,8 +162,6 @@ public: to_readable_packet(std::string((const char*)it->data(), it->size())) ) ); - else - log(to_readable_packet(expected[i])); } } else BOOST_CHECK_MESSAGE( diff --git a/test/integration/receive_publish.cpp b/test/integration/receive_publish.cpp index 20c1ef0..1bfb9a9 100644 --- a/test/integration/receive_publish.cpp +++ b/test/integration/receive_publish.cpp @@ -43,7 +43,6 @@ struct shared_test_data { const std::string publish_qos2 = encoders::encode_publish( 1, topic, payload, qos_e::exactly_once, retain_e::no, dup_e::no, {} ); - const std::string big_publish = encode_big_publish(); const std::string puback = encoders::encode_puback(1, uint8_t(0x00), {}); @@ -55,21 +54,9 @@ struct shared_test_data { private: connect_props allow_big_packets_cprops() { connect_props c_props; - c_props[prop::maximum_packet_size] = std::numeric_limits::max(); + c_props[prop::maximum_packet_size] = 10'000'000; return c_props; } - - std::string encode_big_publish() { - publish_props big_props; - for (int i = 0; i < 100; i++) - big_props[prop::user_property].push_back(std::string(65534, 'u')); - - return encoders::encode_publish( - 1, topic, payload, - qos_e::at_most_once, retain_e::no, dup_e::no, - std::move(big_props) - ); - } }; using test::after; @@ -315,6 +302,18 @@ BOOST_FIXTURE_TEST_CASE(receive_big_publish, shared_test_data) { const int expected_handlers_called = 1; int handlers_called = 0; + // data + publish_props big_props; + for (int i = 0; i < 100; i++) + big_props[prop::user_property].push_back(std::string(65534, 'u')); + + // packets + auto big_publish = encoders::encode_publish( + 1, topic, payload, + qos_e::at_most_once, retain_e::no, dup_e::no, + std::move(big_props) + ); + test::msg_exchange broker_side; broker_side .expect(connect_with_cprops) @@ -342,7 +341,7 @@ BOOST_FIXTURE_TEST_CASE(receive_big_publish, shared_test_data) { BOOST_TEST(!ec); BOOST_TEST(topic == topic_); BOOST_TEST(payload == payload_); - BOOST_TEST(pprops[prop::user_property].size() == 100); + BOOST_TEST(pprops[prop::user_property].size() == 100u); c.cancel(); }); diff --git a/test/integration/send_publish.cpp b/test/integration/send_publish.cpp index 313ccd4..2eab171 100644 --- a/test/integration/send_publish.cpp +++ b/test/integration/send_publish.cpp @@ -416,7 +416,7 @@ BOOST_FIXTURE_TEST_CASE(send_big_publish, shared_test_data) { std::vector buffers; for (size_t i = 0; i < big_publish.size(); i += 65536) buffers.push_back(big_publish.substr(i, 65536)); - BOOST_TEST_REQUIRE(buffers.size() == 3); + BOOST_TEST_REQUIRE(buffers.size() == 3u); // this single async_send will result in 3 calls to async_write_some in our stream test::msg_exchange broker_side;