| 1 | 
 | 
|---|
| 2 | #include "stdafx.h"
 | 
|---|
| 3 | #include <boost/property_tree/ptree.hpp>
 | 
|---|
| 4 | #include <boost/test/minimal.hpp>
 | 
|---|
| 5 | 
 | 
|---|
| 6 | int test_main(int, char *[])
 | 
|---|
| 7 | {
 | 
|---|
| 8 |     using namespace boost::property_tree;
 | 
|---|
| 9 | 
 | 
|---|
| 10 |     ptree pt;
 | 
|---|
| 11 |     pt.put<int>("a",1000000);
 | 
|---|
| 12 |     try
 | 
|---|
| 13 |     {
 | 
|---|
| 14 |         pt.get<unsigned char>("a");
 | 
|---|
| 15 |         BOOST_ERROR("No required exception thrown");
 | 
|---|
| 16 |     }
 | 
|---|
| 17 |     catch (boost::property_tree::ptree_bad_data &) { }
 | 
|---|
| 18 |     catch (...)
 | 
|---|
| 19 |     {
 | 
|---|
| 20 |         BOOST_ERROR("Wrong exception type thrown");
 | 
|---|
| 21 |     }
 | 
|---|
| 22 |     try
 | 
|---|
| 23 |     {
 | 
|---|
| 24 |         pt.get<signed char>("a");
 | 
|---|
| 25 |         BOOST_ERROR("No required exception thrown");
 | 
|---|
| 26 |     }
 | 
|---|
| 27 |     catch (boost::property_tree::ptree_bad_data &) { }
 | 
|---|
| 28 |     catch (...)
 | 
|---|
| 29 |     {
 | 
|---|
| 30 |         BOOST_ERROR("Wrong exception type thrown");
 | 
|---|
| 31 |     }
 | 
|---|
| 32 |     return 0;
 | 
|---|
| 33 | }
 | 
|---|
| 34 | 
 | 
|---|