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

Method testTuple

test/parse_into.cpp:358–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356 }
357
358 void testTuple()
359 {
360 testParseInto<std::pair<std::nullptr_t, std::uint64_t>>(
361 {nullptr, UINT64_MAX} );
362
363 testParseInto<std::tuple<int, float, std::string>>( {} );
364 testParseInto<std::tuple<int, float, std::string>>( std::make_tuple(1, 3.14f, "hello") );
365
366 testParseInto<std::vector<std::pair<int, int>>>( {} );
367 testParseInto<std::vector<std::pair<int, int>>>( { { 1, 2 }, { 3, 4 } } );
368
369 testParseInto<std::vector<std::vector<std::pair<int, int>>>>( {} );
370 testParseInto<std::vector<std::vector<std::pair<int, int>>>>( { { { 1, 2 }, { 3, 4 } } } );
371 testParseInto<std::vector<std::vector<std::pair<int, int>>>>( { { { 1, 2 }, { 3, 4 } }, { { 5, 6 }, { 7, 8 } } } );
372
373 testParseInto<std::map<std::string, std::vector<std::pair<int, int>>>>( {} );
374 testParseInto<std::map<std::string, std::vector<std::pair<int, int>>>>( { { "one", {} } } );
375 testParseInto<std::map<std::string, std::vector<std::pair<int, int>>>>( { { "one", { { 1, 2 }, { 3, 4 } } } } );
376
377 testParseInto<std::pair<std::vector<int>, std::map<std::string, std::pair<int, bool>>>>( {} );
378 testParseInto<std::pair<std::vector<int>, std::map<std::string, std::pair<int, bool>>>>( { { 1, 2, 3 }, { { "one", { 7, true } } } } );
379
380 testParseIntoErrors< std::pair<int, int> >( error::not_array, 1 );
381 testParseIntoErrors< std::pair<int, int> >(
382 error::size_mismatch, {1, 2, 3} );
383 testParseIntoErrors< std::tuple<int, int, int> >(
384 error::size_mismatch, {1, 2} );
385 testParseIntoErrors< std::tuple<std::vector<int>> >(
386 error::size_mismatch, {{1,2}, {3,4}} );
387 testParseIntoErrors<std::map<std::string, std::tuple<int, int>>>(
388 error::size_mismatch, { {"tup", array()} });
389 }
390
391 void testStruct()
392 {

Callers

nothing calls this directly

Calls 1

arrayClass · 0.50

Tested by

no test coverage detected