@@ -178,6 +178,8 @@ TEST_SUITE("[ASYNC]")
178178 std::string text;
179179 std::vector<char > data_peer;
180180 std::vector<char > data_client;
181+ std::string text_peer;
182+ std::string text_client;
181183
182184 std::mt19937 eng (std::random_device{}());
183185 std::uniform_int_distribution<unsigned int > d{0 , 255 };
@@ -202,13 +204,11 @@ TEST_SUITE("[ASYNC]")
202204 http::async_ws_read (peer, data_peer, [&](boost::system::error_code ec, bool is_text) {
203205 REQUIRE (!bool (ec));
204206 REQUIRE (!is_text);
205- REQUIRE (data_peer.size () == data.size ());
206- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (data)));
207- http::async_ws_read (peer, data_peer, [&](boost::system::error_code ec, bool is_text) {
207+ REQUIRE (data_peer == data);
208+ http::async_ws_read (peer, text_peer, [&](boost::system::error_code ec, bool is_text) {
208209 REQUIRE (!bool (ec));
209210 REQUIRE (is_text);
210- REQUIRE (data_peer.size () == text.size ());
211- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (text)));
211+ REQUIRE (text_peer == text);
212212 http::async_ws_read (peer, data_peer, [&](boost::system::error_code ec, bool is_text) {
213213 REQUIRE (ec == http::ws_going_away);
214214 });
@@ -226,7 +226,7 @@ TEST_SUITE("[ASYNC]")
226226 REQUIRE (!bool (ec));
227227 http::async_ws_write (client, boost::asio::buffer (data), false , [&](boost::system::error_code ec, std::size_t ) {
228228 REQUIRE (!bool (ec));
229- http::async_ws_write (client, boost::asio::buffer (text), true , [&](boost::system::error_code ec, std::size_t ) {
229+ http::async_ws_write (client, boost::asio::buffer (text), true , [&](boost::system::error_code ec, std::size_t ) {
230230 REQUIRE (!bool (ec));
231231 http::async_ws_close (client, http::ws_going_away, [&](boost::system::error_code ec) {
232232 REQUIRE (!bool (ec));
@@ -258,12 +258,10 @@ TEST_SUITE("[ASYNC]")
258258 co_await http::async_ws_accept (peer, req);
259259 is_text = co_await http::async_ws_read (peer, data_peer);
260260 REQUIRE (!is_text);
261- REQUIRE (data_peer.size () == data.size ());
262- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (data)));
263- is_text = co_await http::async_ws_read (peer, data_peer);
261+ REQUIRE (data_peer == data);
262+ is_text = co_await http::async_ws_read (peer, text_peer);
264263 REQUIRE (is_text);
265- REQUIRE (data_peer.size () == text.size ());
266- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (text)));
264+ REQUIRE (text_peer == text);
267265 auto [ec, is_text2] = co_await http::async_ws_read (peer, data_peer, as_tuple (deferred));
268266 REQUIRE (ec == http::ws_going_away);
269267 };
@@ -300,12 +298,10 @@ TEST_SUITE("[ASYNC]")
300298 http::async_ws_accept (peer, req, yield);
301299 is_text = http::async_ws_read (peer, data_peer, yield);
302300 REQUIRE (!is_text);
303- REQUIRE (data_peer.size () == data.size ());
304- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (data)));
305- is_text = http::async_ws_read (peer, data_peer, yield);
301+ REQUIRE (data_peer == data);
302+ is_text = http::async_ws_read (peer, text_peer, yield);
306303 REQUIRE (is_text);
307- REQUIRE (data_peer.size () == text.size ());
308- REQUIRE (std::equal (begin (data_peer), end (data_peer), begin (text)));
304+ REQUIRE (text_peer == text);
309305 boost::system::error_code ec{};
310306 is_text = http::async_ws_read (peer, data_peer, yield[ec]);
311307 REQUIRE (ec == http::ws_going_away);
@@ -364,13 +360,11 @@ TEST_SUITE("[ASYNC]")
364360 http::async_ws_read (client, data_client, [&](boost::system::error_code ec, bool is_text) {
365361 REQUIRE (!bool (ec));
366362 REQUIRE (!is_text);
367- REQUIRE (data_client.size () == data.size ());
368- REQUIRE (std::equal (begin (data_client), end (data_client), begin (data)));
369- http::async_ws_read (client, data_client, [&](boost::system::error_code ec, bool is_text) {
363+ REQUIRE (data_client == data);
364+ http::async_ws_read (client, text_client, [&](boost::system::error_code ec, bool is_text) {
370365 REQUIRE (!bool (ec));
371366 REQUIRE (is_text);
372- REQUIRE (data_client.size () == text.size ());
373- REQUIRE (std::equal (begin (data_client), end (data_client), begin (text)));
367+ REQUIRE (text_client == text);
374368 http::async_ws_read (client, data_client, [&](boost::system::error_code ec, bool is_text) {
375369 REQUIRE (ec == http::ws_going_away);
376370 });
@@ -410,12 +404,10 @@ TEST_SUITE("[ASYNC]")
410404 co_await http::async_ws_handshake (client, " localhost" , " /ws" );
411405 is_text = co_await http::async_ws_read (client, data_client);
412406 REQUIRE (!is_text);
413- REQUIRE (data_client.size () == data.size ());
414- REQUIRE (std::equal (begin (data_client), end (data_client), begin (data)));
415- is_text = co_await http::async_ws_read (client, data_client);
407+ REQUIRE (data_client == data);
408+ is_text = co_await http::async_ws_read (client, text_client);
416409 REQUIRE (is_text);
417- REQUIRE (data_client.size () == text.size ());
418- REQUIRE (std::equal (begin (data_client), end (data_client), begin (text)));
410+ REQUIRE (text_client == text);
419411 auto [ec, is_text2] = co_await http::async_ws_read (client, data_client, as_tuple (deferred));
420412 REQUIRE (ec == http::ws_going_away);
421413 };
@@ -452,12 +444,10 @@ TEST_SUITE("[ASYNC]")
452444 http::async_ws_handshake (client, " localhost" , " /ws" , yield);
453445 is_text = http::async_ws_read (client, data_client, yield);
454446 REQUIRE (!is_text);
455- REQUIRE (data_client.size () == data.size ());
456- REQUIRE (std::equal (begin (data_client), end (data_client), begin (data)));
457- is_text = http::async_ws_read (client, data_client, yield);
447+ REQUIRE (data_client == data);
448+ is_text = http::async_ws_read (client, text_client, yield);
458449 REQUIRE (is_text);
459- REQUIRE (data_client.size () == text.size ());
460- REQUIRE (std::equal (begin (data_client), end (data_client), begin (text)));
450+ REQUIRE (text_client == text);
461451 boost::system::error_code ec{};
462452 is_text = http::async_ws_read (client, data_client, yield[ec]);
463453 REQUIRE (ec == http::ws_going_away);
0 commit comments