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

Method testSwap

test/string.cpp:2549–2587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2547 }
2548
2549 void
2550 testSwap()
2551 {
2552 test_vectors const t;
2553
2554 fail_loop([&](storage_ptr const& sp)
2555 {
2556 string s1(t.v1, sp);
2557 string s2(t.v2, sp);
2558 s1.swap(s2);
2559 BOOST_TEST(s1 == t.v2);
2560 BOOST_TEST(s2 == t.v1);
2561 });
2562
2563 fail_loop([&](storage_ptr const& sp)
2564 {
2565 string s1(t.v1, sp);
2566 string s2(t.v2, sp);
2567 swap(s1, s2);
2568 BOOST_TEST(s1 == t.v2);
2569 BOOST_TEST(s2 == t.v1);
2570 });
2571
2572 fail_loop([&](storage_ptr const& sp)
2573 {
2574 string s1(t.v1);
2575 string s2(t.v2, sp);
2576 s1.swap(s2);
2577 BOOST_TEST(s1 == t.v2);
2578 BOOST_TEST(s2 == t.v1);
2579 });
2580
2581 fail_loop([&](storage_ptr const& sp)
2582 {
2583 string s(t.v1, sp);
2584 swap(s, s);
2585 BOOST_TEST(s == t.v1);
2586 });
2587 }
2588
2589 void
2590 testFind()

Callers

nothing calls this directly

Calls 2

fail_loopFunction · 0.85
swapMethod · 0.45

Tested by

no test coverage detected