| 382 | |
| 383 | template< class... Context > |
| 384 | static |
| 385 | void |
| 386 | testGeneral( Context const& ... ctx ) |
| 387 | { |
| 388 | { |
| 389 | int a[4] = {1, 2, 3, 4}; |
| 390 | value b{1, 2, 3, 4}; |
| 391 | value c = value_from( a, ctx... ); |
| 392 | BOOST_TEST(c.is_array()); |
| 393 | BOOST_TEST(serialize(c) == serialize(b)); |
| 394 | } |
| 395 | { |
| 396 | std::tuple<int, string, int, bool> a{1, "2", 42, true}; |
| 397 | value b{1, "2", 42, true}; |
| 398 | value c = value_from( a, ctx... ); |
| 399 | BOOST_TEST(c.is_array()); |
| 400 | BOOST_TEST(serialize(c) == serialize(b)); |
| 401 | } |
| 402 | { |
| 403 | std::array<int, 500> a; |
| 404 | a.fill(0); |
| 405 | |
| 406 | value b; |
| 407 | array& b_arr = b.emplace_array(); |
| 408 | b_arr.insert(b_arr.end(), a.begin(), a.end()); |
| 409 | |
| 410 | BOOST_TEST(value_from( a, ctx... ) == b); |
| 411 | } |
| 412 | { |
| 413 | std::pair<int, string> a{1, string("2")}; |
| 414 | value b{1, "2"}; |
| 415 | value c = value_from( a, ctx... ); |
| 416 | BOOST_TEST(c.is_array()); |
| 417 | BOOST_TEST(serialize(c) == serialize(b)); |
| 418 | } |
| 419 | { |
| 420 | // ensures that this isn't parsed as a key value pair |
| 421 | std::pair<string_view, int> a{"2", 1}; |
| 422 | value b{"2", 1}; |
| 423 | value c = value_from( a, ctx... ); |
| 424 | BOOST_TEST(c.is_array()); |
| 425 | BOOST_TEST(serialize(c) == serialize(b)); |
| 426 | } |
| 427 | { |
| 428 | key_value_pair a{"2", 1}; |
| 429 | value b{"2", 1}; |
| 430 | value c = value_from( a, ctx... ); |
| 431 | BOOST_TEST(c.is_array()); |
| 432 | BOOST_TEST(serialize(c) == serialize(b)); |
| 433 | } |
| 434 | { |
| 435 | ::value_from_test_ns::T7 a; |
| 436 | value b = value_from( a, ctx... ); |
| 437 | BOOST_TEST(b.is_null()); |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | template< class... Context > |