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

Method testCapacity

test/array.cpp:726–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724 }
725
726 void
727 testCapacity()
728 {
729 // empty()
730 {
731 {
732 array a;
733 BOOST_TEST(a.empty());
734 a.emplace_back(1);
735 BOOST_TEST(! a.empty());
736 }
737
738 {
739 array a({1, 2});
740 BOOST_TEST(! a.empty());
741 a.clear();
742 BOOST_TEST(a.empty());
743 BOOST_TEST(a.capacity() > 0);
744 }
745 }
746
747 // size()
748 {
749 array a;
750 BOOST_TEST(a.size() == 0);
751 a.emplace_back(1);
752 BOOST_TEST(a.size() == 1);
753 }
754
755 // max_size()
756 {
757 array a;
758 BOOST_TEST(a.max_size() > 0);
759 }
760
761 // reserve()
762 {
763 {
764 array a;
765 a.reserve(0);
766 }
767
768 {
769 array a(3);
770 a.reserve(1);
771 }
772
773 {
774 array a(3);
775 a.reserve(0);
776 }
777
778 {
779 array a;
780 a.reserve(50);
781 BOOST_TEST(a.capacity() >= 50);
782 }
783

Callers

nothing calls this directly

Calls 9

fail_loopFunction · 0.85
resizeMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
capacityMethod · 0.45
sizeMethod · 0.45
max_sizeMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected