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

Method testStruct

test/parse_into.cpp:391–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389 }
390
391 void testStruct()
392 {
393#if defined(BOOST_DESCRIBE_CXX14)
394 testParseInto<X>( {} );
395 testParseInto<X>( { 1, 3.14f, "hello" } );
396
397 testParseInto<Y>( {} );
398 testParseInto<Y>( { { { 1, 1.0f, "one" }, { 2, 2.0f, "two" } }, { { "one", { 1, 1.1f, "1" } }, { "two", { 2, 2.2f, "2" } } } } );
399
400 testParseInto<Z>( {} );
401 testParseInto<Z>( { {1, 3.14f, "hello"}, true } );
402
403 testParseIntoErrors<X>( error::not_object, 1 );
404 testParseIntoErrors<X>( error::size_mismatch, { {"a", 1} } );
405
406 object jo{ {"a", 1}, {"b", 3.14f}, {"c", "hello"} };
407 jo["e1"] = array{1, ULONG_MAX, "three", array{}, true, .5, nullptr};
408 jo["e2"] = object{ {"one", 1}, {"two", 2}, {"three", object{}} };
409 jo["e3"] = "third extra element";
410 jo["e4"] = 100;
411 jo["e5"] = ULONG_MAX;
412 jo["e6"] = 12.4;
413 jo["e7"] = false;
414 jo["e8"] = nullptr;
415 testParseIntoValue<X>(jo);
416
417 object const unexpected_jo{{"x", object{{"unexpectedArray", array{}},
418 {"unexpectedObject", object{}},
419 {"unexpectedString", "qwerty"},
420 {"unexpectedInt", 42},
421 {"unexpectedUint", ULONG_MAX},
422 {"unexpectedDouble", 2.71},
423 {"unexpectedBool", true},
424 {"unexpectedNull", nullptr},
425 {"a", 1},
426 {"b", 3.14f},
427 {"c", "hello"}}}};
428 testParseIntoValue<W>(unexpected_jo);
429#endif
430 }
431
432 void testEnum()
433 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected