MCPcopy Create free account
hub / github.com/boostorg/json / testResize

Method testResize

test/string.cpp:2485–2547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2483 }
2484
2485 void
2486 testResize()
2487 {
2488 test_vectors const t;
2489
2490 // resize(size_type)
2491 {
2492 fail_loop([&](storage_ptr const& sp)
2493 {
2494 string s(sp);
2495 s.resize(t.v1.size());
2496 BOOST_TEST(s.size() == t.v1.size());
2497 BOOST_TEST(s == string(t.v1.size(), '\0'));
2498 });
2499
2500 fail_loop([&](storage_ptr const& sp)
2501 {
2502 string s(sp);
2503 s.resize(t.v2.size());
2504 BOOST_TEST(s.size() == t.v2.size());
2505 BOOST_TEST(s == string(t.v2.size(), '\0'));
2506 });
2507
2508 fail_loop([&](storage_ptr const& sp)
2509 {
2510 string s(sp);
2511 s.resize(t.v1.size());
2512 s.resize(t.v2.size());
2513 BOOST_TEST(s == string(t.v2.size(), '\0'));
2514 s.resize(t.v1.size());
2515 BOOST_TEST(s == string(t.v1.size(), '\0'));
2516 });
2517 }
2518
2519 // resize(size_type, char)
2520 {
2521 fail_loop([&](storage_ptr const& sp)
2522 {
2523 string s(sp);
2524 s.resize(t.v1.size(), '*');
2525 BOOST_TEST(s.size() == t.v1.size());
2526 BOOST_TEST(s == string(t.v1.size(), '*'));
2527 });
2528
2529 fail_loop([&](storage_ptr const& sp)
2530 {
2531 string s(sp);
2532 s.resize(t.v2.size(), '*');
2533 BOOST_TEST(s.size() == t.v2.size());
2534 BOOST_TEST(s == string(t.v2.size(), '*'));
2535 });
2536
2537 fail_loop([&](storage_ptr const& sp)
2538 {
2539 string s(sp);
2540 s.resize(t.v1.size(), '*');
2541 s.resize(t.v2.size(), '*');
2542 BOOST_TEST(s == string(t.v2.size(), '*'));

Callers

nothing calls this directly

Calls 4

fail_loopFunction · 0.85
resizeMethod · 0.80
stringClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected