Skip to content

Commit cd4141b

Browse files
committed
Replace uses of BOOST_TEST_EQ for large strings in tests
1 parent 56c0a98 commit cd4141b

File tree

3 files changed

+27
-30
lines changed

3 files changed

+27
-30
lines changed

test/unit/parser.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,11 +1272,11 @@ struct parser_test
12721272
}
12731273
if(pr_->is_complete())
12741274
{
1275-
BOOST_TEST_EQ(pr_->body(), sb_);
1275+
BOOST_TEST(pr_->body() == sb_);
12761276
// this should be a no-op
12771277
read(*pr_, in, ec);
12781278
BOOST_TEST(! ec.failed());
1279-
BOOST_TEST_EQ(pr_->body(), sb_);
1279+
BOOST_TEST(pr_->body() == sb_);
12801280
return;
12811281
}
12821282
read(*pr_, in, ec);
@@ -1288,11 +1288,11 @@ struct parser_test
12881288
}
12891289
if(! BOOST_TEST(pr_->is_complete()))
12901290
return;
1291-
BOOST_TEST_EQ(pr_->body(), sb_);
1291+
BOOST_TEST(pr_->body() == sb_);
12921292
// this should be a no-op
12931293
read(*pr_, in, ec);
12941294
BOOST_TEST(! ec.failed());
1295-
BOOST_TEST_EQ(pr_->body(), sb_);
1295+
BOOST_TEST(pr_->body() == sb_);
12961296
}
12971297

12981298
void
@@ -1325,13 +1325,13 @@ struct parser_test
13251325
if(! BOOST_TEST(pr_->is_complete()))
13261326
return;
13271327
}
1328-
BOOST_TEST_EQ(
1329-
test_to_string(fb.data()), sb_);
1328+
BOOST_TEST(
1329+
test_to_string(fb.data()) == sb_);
13301330
// this should be a no-op
13311331
read(*pr_, in, ec);
13321332
BOOST_TEST(! ec.failed());
1333-
BOOST_TEST_EQ(
1334-
test_to_string(fb.data()), sb_);
1333+
BOOST_TEST(
1334+
test_to_string(fb.data()) == sb_);
13351335
}
13361336

13371337
void
@@ -1362,11 +1362,11 @@ struct parser_test
13621362
if(! BOOST_TEST(pr_->is_complete()))
13631363
return;
13641364
}
1365-
BOOST_TEST_EQ(ts.s, sb_);
1365+
BOOST_TEST(ts.s == sb_);
13661366
// this should be a no-op
13671367
read(*pr_, in, ec);
13681368
BOOST_TEST(! ec.failed());
1369-
BOOST_TEST_EQ(ts.s, sb_);
1369+
BOOST_TEST(ts.s == sb_);
13701370
}
13711371

13721372

@@ -1642,7 +1642,7 @@ struct parser_test
16421642
BOOST_TEST(pr.is_complete());
16431643

16441644
auto str = pr.body();
1645-
BOOST_TEST_EQ(str, "hello, world!");
1645+
BOOST_TEST(str == "hello, world!");
16461646
}
16471647

16481648
{
@@ -1674,7 +1674,7 @@ struct parser_test
16741674
read(pr, in2, ec);
16751675
BOOST_TEST(! ec.failed());
16761676
BOOST_TEST(pr.is_complete());
1677-
BOOST_TEST_EQ(pr.body(), "hello, world!");
1677+
BOOST_TEST(pr.body() == "hello, world!");
16781678
}
16791679

16801680
{
@@ -1755,9 +1755,9 @@ struct parser_test
17551755
system::error_code ec;
17561756
read(pr, in, ec);
17571757
BOOST_TEST(pr.is_complete());
1758-
BOOST_TEST_EQ(
1759-
pr.body(),
1760-
"hello, world! and this is a much longer string of text");
1758+
BOOST_TEST(
1759+
pr.body() ==
1760+
"hello, world! and this is a much longer string of text");
17611761
}
17621762

17631763
{
@@ -1841,9 +1841,9 @@ struct parser_test
18411841

18421842
read(pr, in, ec);
18431843
BOOST_TEST(pr.is_complete());
1844-
BOOST_TEST_EQ(
1845-
pr.body(),
1846-
"hello, world! and this is a much longer string of text");
1844+
BOOST_TEST(
1845+
pr.body() ==
1846+
"hello, world! and this is a much longer string of text");
18471847
}
18481848
}
18491849
}

test/unit/serializer.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ struct serializer_test
152152

153153
if( chunk_size == 0 ) // last chunk
154154
{
155-
BOOST_TEST_EQ(chunked_body, "\r\n");
156-
BOOST_TEST_EQ(chunked_body.size(), 2);
155+
BOOST_TEST(chunked_body == "\r\n");
157156
chunked_body.remove_prefix(2);
158157
break;
159158
}
@@ -229,7 +228,7 @@ struct serializer_test
229228
serializer sr(ctx);
230229
sr.start(res);
231230
std::string s = read(sr);
232-
BOOST_TEST_EQ(s, expected);
231+
BOOST_TEST(s == expected);
233232
};
234233

235234
check(
@@ -481,8 +480,8 @@ struct serializer_test
481480
"Content-Length: 2048\r\n"
482481
"\r\n";
483482

484-
BOOST_TEST_EQ(
485-
s.substr(0, header.size()), header);
483+
BOOST_TEST(
484+
s.substr(0, header.size()) == header);
486485
BOOST_TEST(s ==
487486
"HTTP/1.1 200 OK\r\n"
488487
"Server: test\r\n"
@@ -623,8 +622,8 @@ struct serializer_test
623622
s.starts_with(expected_header));
624623

625624
s.remove_prefix(expected_header.size());
626-
BOOST_TEST_EQ(
627-
s, std::string(13370, '*'));
625+
BOOST_TEST(
626+
s == std::string(13370, '*'));
628627
});
629628
}
630629

@@ -800,9 +799,7 @@ struct serializer_test
800799
mcbs = sr.prepare();
801800
std::string body;
802801
append(body, *mcbs);
803-
BOOST_TEST_EQ(
804-
"0\r\n\r\n",
805-
body);
802+
BOOST_TEST(body == "0\r\n\r\n");
806803
sr.consume(5);
807804

808805
BOOST_TEST(sr.is_done());

test/unit/zlib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ struct zlib_test
207207
core::string_view sv2(
208208
reinterpret_cast<char const*>(
209209
decompressed_output.data()), n);
210-
BOOST_TEST_EQ(sv2, expected);
210+
BOOST_TEST(sv2 == expected);
211211

212212
::inflateEnd(&zs);
213213
return;
@@ -464,7 +464,7 @@ struct zlib_test
464464

465465
if( chunk_size == 0 )
466466
{
467-
BOOST_TEST_EQ(chunk, "\r\n");
467+
BOOST_TEST(chunk == "\r\n");
468468
}
469469
else
470470
{

0 commit comments

Comments
 (0)