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

Method testModifiers

test/object.cpp:894–1372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892 //------------------------------------------------------
893
894 void
895 testModifiers()
896 {
897 DECLARE_INIT_LISTS;
898
899 // clear
900 {
901 // empty
902 {
903 object o;
904 o.clear();
905 BOOST_TEST(o.empty());
906 }
907
908 // small
909 {
910 object o(i0_);
911 BOOST_TEST(! o.empty());
912 o.clear();
913 BOOST_TEST(o.empty());
914 }
915
916 // large
917 {
918 object o(i1_);
919 BOOST_TEST(! o.empty());
920 o.clear();
921 BOOST_TEST(o.empty());
922 }
923 }
924
925 // insert(P&&)
926 {
927 fail_loop([&](storage_ptr const& sp)
928 {
929 object o(sp);
930 auto result = o.insert(
931 std::make_pair("x", 1));
932 BOOST_TEST(result.second);
933 BOOST_TEST(result.first->key() == "x");
934 BOOST_TEST(result.first->value().as_int64() == 1);
935 });
936
937 fail_loop([&](storage_ptr const& sp)
938 {
939 object o(sp);
940 auto const p = std::make_pair("x", 1);
941 auto result = o.insert(p);
942 BOOST_TEST(result.second);
943 BOOST_TEST(result.first->key() == "x");
944 BOOST_TEST(result.first->value().as_int64() == 1);
945 });
946
947 fail_loop([&](storage_ptr const& sp)
948 {
949 object o({
950 {"a", 1},
951 {"b", 2},

Callers

nothing calls this directly

Calls 15

fail_loopFunction · 0.85
checkFunction · 0.85
make_input_iteratorFunction · 0.85
serializeFunction · 0.85
keyMethod · 0.80
valueMethod · 0.80
is_stringMethod · 0.80
emplaceMethod · 0.80
findMethod · 0.80
objectClass · 0.50
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected