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

Method testMap

test/parse_into.cpp:331–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329 }
330
331 void testMap()
332 {
333 testParseInto< std::map<std::string, int> >( {} );
334 testParseInto< std::map<std::string, int> >( { { "one", 1 }, { "two", 2 } } );
335
336 testParseInto< std::map<std::string, int> >( {} );
337 testParseInto< std::map<std::string, int> >( { { "one", 1 }, { "two", 2 } } );
338
339 testParseInto< std::map<std::string, std::vector<int>> >( {} );
340 testParseInto< std::map<std::string, std::vector<int>> >( { { "one", { 1 } }, { "two", { 2, 3 } } } );
341
342 testParseInto< std::map<std::string, std::map<std::string, int>> >( {} );
343 testParseInto< std::map<std::string, std::map<std::string, int>> >( { { "one", {} }, { "two", { { "1", 1 }, { "2", 2 } } } } );
344
345 testParseIntoErrors< std::map<std::string, int> >(
346 error::not_object, { "1", 1, "2", 2} );
347 testParseIntoErrors< std::map<std::string, std::map<std::string, int>> >(
348 error::not_object, { {"1", {}}, {"2", {"3", 4}} } );
349
350 std::map<std::string, int> m;
351 parse_into(m, R"( {"1": 1, "2": 2, "3": 3} )");
352 BOOST_TEST( m.size() == 3 );
353
354 parse_into(m, R"( {"4": 4, "5": 5} )");
355 BOOST_TEST( m.size() == 2 );
356 }
357
358 void testTuple()
359 {

Callers

nothing calls this directly

Calls 2

parse_intoFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected