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

Method testAs

test/value.cpp:1707–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1705 }
1706
1707 void
1708 testAs()
1709 {
1710 value obj(object{});
1711 value arr(array{});
1712 value str(string{});
1713 value i64(std::int64_t{});
1714 value u64(std::uint64_t{});
1715 value dub(double{});
1716 value boo(true);
1717 value nul(nullptr);
1718
1719 auto const& cobj(obj);
1720 auto const& carr(arr);
1721 auto const& cstr(str);
1722 auto const& ci64(i64);
1723 auto const& cu64(u64);
1724 auto const& cdub(dub);
1725 auto const& cboo(boo);
1726 auto const& cnul(nul);
1727
1728 // as_object() &
1729 {
1730 object& x = obj.as_object();
1731 BOOST_TEST_THROWS_WITH_LOCATION( arr.as_object() );
1732 BOOST_TEST_THROWS_WITH_LOCATION( str.as_object() );
1733 BOOST_TEST_THROWS_WITH_LOCATION( i64.as_object() );
1734 BOOST_TEST_THROWS_WITH_LOCATION( u64.as_object() );
1735 BOOST_TEST_THROWS_WITH_LOCATION( dub.as_object() );
1736 BOOST_TEST_THROWS_WITH_LOCATION( boo.as_object() );
1737 BOOST_TEST_THROWS_WITH_LOCATION( nul.as_object() );
1738 (void)x;
1739 }
1740
1741 // as_object() const&
1742 {
1743 object const& x = cobj.as_object();
1744 BOOST_TEST_THROWS_WITH_LOCATION( carr.as_object() );
1745 BOOST_TEST_THROWS_WITH_LOCATION( cstr.as_object() );
1746 BOOST_TEST_THROWS_WITH_LOCATION( ci64.as_object() );
1747 BOOST_TEST_THROWS_WITH_LOCATION( cu64.as_object() );
1748 BOOST_TEST_THROWS_WITH_LOCATION( cdub.as_object() );
1749 BOOST_TEST_THROWS_WITH_LOCATION( cboo.as_object() );
1750 BOOST_TEST_THROWS_WITH_LOCATION( cnul.as_object() );
1751 (void)x;
1752 }
1753
1754 // as_object() &&
1755 {
1756 object&& x = std::move(obj).as_object();
1757 BOOST_TEST_THROWS_WITH_LOCATION( std::move(arr).as_object() );
1758 BOOST_TEST_THROWS_WITH_LOCATION( std::move(str).as_object() );
1759 BOOST_TEST_THROWS_WITH_LOCATION( std::move(i64).as_object() );
1760 BOOST_TEST_THROWS_WITH_LOCATION( std::move(u64).as_object() );
1761 BOOST_TEST_THROWS_WITH_LOCATION( std::move(dub).as_object() );
1762 BOOST_TEST_THROWS_WITH_LOCATION( std::move(boo).as_object() );
1763 BOOST_TEST_THROWS_WITH_LOCATION( std::move(nul).as_object() );
1764 (void)x;

Callers

nothing calls this directly

Calls 1

valueMethod · 0.80

Tested by

no test coverage detected