Пример #1
0
void const_test_f( json::value const & value )
{
   BOOST_CHECK(value.has_key("cafe"));

   BOOST_CHECK_THROW(value["sam"], std::out_of_range);

   BOOST_CHECK_EQUAL(value["cafe"], "open");
   BOOST_CHECK_EQUAL(value["bar"][2], 1234.5);
}
Пример #2
0
void const_test( json::value const & value )
{
   BOOST_TEST( value.has_key("cafe") );

   try
   {
      value["sam"];
      int should_have_thrown = 1;
      BOOST_TEST( should_have_thrown == 0 );
   }
   catch( std::out_of_range & e )
   {}

   BOOST_TEST( value["cafe"] == "open" );
   BOOST_TEST( value["bar"][2] == 1234.5 );
}