| 315 | |
| 316 | template< class... Context > |
| 317 | static |
| 318 | void |
| 319 | testGenerics( Context const& ... ctx ) |
| 320 | { |
| 321 | BOOST_TEST_CONV( std::string("test"), ctx... ); |
| 322 | BOOST_TEST_CONV( |
| 323 | (std::map<std::string, int> |
| 324 | { |
| 325 | {"a", 1}, {"b", 2}, {"c", 3} |
| 326 | }), |
| 327 | ctx... ); |
| 328 | BOOST_TEST_CONV( |
| 329 | (std::multimap<std::string, int> |
| 330 | { |
| 331 | {"2", 4}, {"3", 9}, {"5", 25} |
| 332 | }), |
| 333 | ctx... ); |
| 334 | BOOST_TEST_CONV( |
| 335 | (std::unordered_map<std::string, int> |
| 336 | { |
| 337 | { "a", 1 }, {"b", 2}, {"c", 3} |
| 338 | }), |
| 339 | ctx... ); |
| 340 | BOOST_TEST_CONV( (std::vector<int>{1, 2, 3, 4}), ctx... ); |
| 341 | BOOST_TEST_CONV( |
| 342 | (std::vector<bool>{true, false, false, true}), ctx... ); |
| 343 | BOOST_TEST_CONV( |
| 344 | std::make_pair(std::string("test"), 5), ctx... ); |
| 345 | BOOST_TEST_CONV( |
| 346 | std::make_tuple( |
| 347 | std::string("outer"), std::make_pair(std::string("test"), 5) ), |
| 348 | ctx... ); |
| 349 | BOOST_TEST_CONV( |
| 350 | (std::map<int, int> |
| 351 | { |
| 352 | {2, 4}, {3, 9}, {5, 25} |
| 353 | }), |
| 354 | ctx... ); |
| 355 | |
| 356 | { |
| 357 | std::array<int, 500> arr; |
| 358 | arr.fill(0); |
| 359 | BOOST_TEST_CONV( arr, ctx... ); |
| 360 | } |
| 361 | |
| 362 | // mismatched type |
| 363 | BOOST_TEST_THROWS_WITH_LOCATION( |
| 364 | value_to<std::string>( value(), ctx... )); |
| 365 | |
| 366 | // mismatched type |
| 367 | BOOST_TEST_THROWS_WITH_LOCATION( |
| 368 | (value_to<std::map<std::string, int>>( value(), ctx... ))); |
| 369 | // element fails |
| 370 | BOOST_TEST_THROWS_WITH_LOCATION( |
| 371 | (value_to<std::map<std::string, int>>( |
| 372 | value{{"1", 1}, {"2", true}, {"3", false}}, ctx... ))); |
| 373 | // reserve fails |
| 374 | BOOST_TEST_THROWS_WITH_LOCATION( |