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

Method testIssue1211

test/beast/http/basic_parser.cpp:1296–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1294 }
1295
1296 void
1297 testIssue1211()
1298 {
1299 using base = detail::basic_parser_base;
1300 auto const good =
1301 [&](string_view s, std::uint32_t v0)
1302 {
1303 std::uint64_t v;
1304 auto const result =
1305 base::parse_dec(s, v);
1306 if(BEAST_EXPECTS(result, s))
1307 BEAST_EXPECTS(v == v0, s);
1308 };
1309 auto const bad =
1310 [&](string_view s)
1311 {
1312 std::uint64_t v;
1313 auto const result =
1314 base::parse_dec(s, v);
1315 BEAST_EXPECTS(! result, s);
1316 };
1317 good("0", 0);
1318 good("00", 0);
1319 good("001", 1);
1320 good("255", 255);
1321 good("65535", 65535);
1322 good("65536", 65536);
1323 good("4294967295", 4294967295);
1324 bad ("");
1325 bad (" ");
1326 bad (" 0");
1327 bad ("0 ");
1328 bad ("-1");
1329 bad ("18446744073709551616"); // max(uint64) + 1
1330 }
1331
1332 void
1333 testIssue1267()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected