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

Method testOptional

test/value_to.cpp:523–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521
522 template< class... Context >
523 static
524 void testOptional( Context const& ... ctx )
525 {
526 ignore_unused( ctx... );
527#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
528 using Opts = std::vector<std::optional<int>>;
529 value jv = value{1, nullptr, 3, nullptr, 5};
530 auto opts = value_to<Opts>( jv, ctx... );
531 BOOST_TEST( opts == (Opts{1, {}, 3, {}, 5}) );
532
533 value_to< std::nullopt_t >(value());
534 BOOST_TEST_THROWS_WITH_LOCATION(
535 value_to< std::nullopt_t >( jv, ctx... ));
536#endif
537 }
538
539 template<
540 template <class...> class Variant, class Monostate, class... Context >

Callers

nothing calls this directly

Calls 1

valueClass · 0.70

Tested by

no test coverage detected