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

Method testAssign

test/string.cpp:619–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617 }
618
619 void
620 testAssign()
621 {
622 test_vectors const t;
623
624 // assign(size_type, char)
625 {
626 fail_loop([&](storage_ptr const& sp)
627 {
628 string s(t.v1.size(), 'x', sp);
629 s.assign(t.v1.size(), '*');
630 BOOST_TEST(
631 s == std::string(t.v1.size(), '*'));
632 });
633
634 fail_loop([&](storage_ptr const& sp)
635 {
636 string s(t.v2.size(), 'x', sp);
637 s.assign(t.v1.size(), '*');
638 BOOST_TEST(
639 s == std::string(t.v1.size(), '*'));
640 });
641
642 fail_loop([&](storage_ptr const& sp)
643 {
644 string s(t.v1.size(), 'x', sp);
645 s.assign(t.v2.size(), '*');
646 BOOST_TEST(
647 s == std::string(t.v2.size(), '*'));
648 });
649
650 fail_loop([&](storage_ptr const& sp)
651 {
652 string s(t.v2.size(), 'x', sp);
653 s.assign(t.v2.size(), '*');
654 BOOST_TEST(
655 s == std::string(t.v2.size(), '*'));
656 });
657 }
658
659 // assign(string)
660 {
661 fail_loop([&](storage_ptr const& sp)
662 {
663 string s(t.v1.size(), 'x', sp);
664 s.assign(string(t.v1.size(), '*'));
665 BOOST_TEST(
666 s == std::string(t.v1.size(), '*'));
667 });
668
669 fail_loop([&](storage_ptr const& sp)
670 {
671 string s(t.v2.size(), 'x', sp);
672 s.assign(string(t.v1.size(), '*'));
673 BOOST_TEST(
674 s == std::string(t.v1.size(), '*'));
675 });
676

Callers

nothing calls this directly

Calls 8

fail_loopFunction · 0.85
make_input_iteratorFunction · 0.85
c_strMethod · 0.80
stringClass · 0.50
sizeMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected