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

Method testModifiers

test/array.cpp:848–1211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846 }
847
848 void
849 testModifiers()
850 {
851 // clear
852 {
853 {
854 array a;
855 BOOST_TEST(a.size() == 0);
856 BOOST_TEST(a.capacity() == 0);
857 a.clear();
858 BOOST_TEST(a.size() == 0);
859 BOOST_TEST(a.capacity() == 0);
860 }
861 {
862 array a({1, true, str_});
863 a.clear();
864 BOOST_TEST(a.size() == 0);
865 BOOST_TEST(a.capacity() > 0);
866 }
867 }
868
869 // insert(const_iterator, value_type const&)
870 {
871 // fast path
872 fail_loop([&](storage_ptr const& sp)
873 {
874 array a({1, 2, 3}, sp);
875 a.pop_back();
876 BOOST_TEST(
877 a.capacity() > a.size());
878 a.insert(a.begin(), 1);
879 BOOST_TEST(
880 a == array({1, 1, 2}));
881 });
882
883 // self-insert
884 {
885 array a = {1, 2, 3};
886 a.insert(a.begin(), a[1]);
887 BOOST_TEST(
888 a == array({2, 1, 2, 3}));
889 }
890
891 // fail
892 fail_loop([&](storage_ptr const& sp)
893 {
894 array a({1, str_}, sp);
895 value v(true);
896 a.insert(a.begin() + 1, v);
897 check(a);
898 check_storage(a, sp);
899 });
900 }
901
902 // insert(const_iterator, value_type&&)
903 fail_loop([&](storage_ptr const& sp)
904 {
905 array a({1, str_}, sp);

Callers

nothing calls this directly

Calls 15

fail_loopFunction · 0.85
checkFunction · 0.85
check_storageFunction · 0.85
make_input_iteratorFunction · 0.85
is_numberMethod · 0.80
is_stringMethod · 0.80
emplaceMethod · 0.80
resizeMethod · 0.80
arrayClass · 0.50
sizeMethod · 0.45
capacityMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected