MCPcopy Create free account
hub / github.com/boostorg/beast / testIssue1267

Method testIssue1267

test/beast/http/basic_parser.cpp:1332–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1330 }
1331
1332 void
1333 testIssue1267()
1334 {
1335 using base = detail::basic_parser_base;
1336 auto const good =
1337 [&](string_view s, std::uint64_t v0)
1338 {
1339 std::uint64_t v;
1340 auto it = s.data();
1341 auto const result =
1342 base::parse_hex(it, v);
1343 if(BEAST_EXPECTS(result, s))
1344 BEAST_EXPECTS(v == v0, s);
1345 };
1346 auto const bad =
1347 [&](string_view s)
1348 {
1349 std::uint64_t v;
1350 auto it = s.data();
1351 auto const result =
1352 base::parse_hex(it, v);
1353 BEAST_EXPECTS(! result, s);
1354 };
1355 good("f\r\n", 15);
1356 good("ff\r\n", 255);
1357 good("ffff\r\n", 65535);
1358 good("ffffffffr\n", 4294967295);
1359 good("ffffffffffffffff\r\n", 18446744073709551615ULL);
1360 bad ("\r\n");
1361 bad ("g\r\n");
1362 bad ("10000000000000000\r\n");
1363 bad ("ffffffffffffffffffffff\r\n");
1364 }
1365
1366 //--------------------------------------------------------------------------
1367

Callers

nothing calls this directly

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected