| 282 | } |
| 283 | |
| 284 | void testSequence() |
| 285 | { |
| 286 | testParseInto<std::vector<std::nullptr_t>>( { nullptr, nullptr } ); |
| 287 | |
| 288 | testParseInto< std::vector<bool> >( {} ); |
| 289 | testParseInto< std::vector<bool> >( { true, false } ); |
| 290 | |
| 291 | testParseInto< std::vector<int> >( {} ); |
| 292 | testParseInto< std::vector<int> >( { 1, 2, 3 } ); |
| 293 | testParseInto< std::vector<std::uint64_t> >( { 1, 2, UINT64_MAX } ); |
| 294 | |
| 295 | testParseInto< std::vector<float> >( {} ); |
| 296 | testParseInto< std::vector<float> >( { 1.02f, 2.11f, 3.14f } ); |
| 297 | |
| 298 | testParseInto< std::vector<std::string> >( {} ); |
| 299 | testParseInto< std::vector<std::string> >( { "one", "two", "three" } ); |
| 300 | |
| 301 | testParseInto< std::vector<std::vector<int>> >( {} ); |
| 302 | testParseInto< std::vector<std::vector<int>> >( { {}, { 1 }, { 2, 3 }, { 4, 5, 6 } } ); |
| 303 | |
| 304 | testParseInto< std::vector<std::map<std::string, int>> >( |
| 305 | { {}, { {"1", 2}, {"3", 4} }, { { "5", 6 } } } ); |
| 306 | |
| 307 | // clang <= 5 doesn't like when std::array is created from init-list |
| 308 | std::array<int, 4> arr; |
| 309 | arr.fill(17); |
| 310 | testParseInto< std::array<int, 4> >( arr ); |
| 311 | |
| 312 | testParseIntoErrors< std::vector<int> >( error::not_array, 1 ); |
| 313 | testParseIntoErrors< std::vector<char> >( error::not_array, "abcd" ); |
| 314 | testParseIntoErrors< std::vector<std::vector<int>> >( |
| 315 | error::not_array, {1, 2, 3} ); |
| 316 | testParseIntoErrors< std::array<int, 4> >( |
| 317 | error::size_mismatch, {1, 2, 3} ); |
| 318 | testParseIntoErrors< std::array<int, 4> >( |
| 319 | error::size_mismatch, {1, 2, 3, 4, 5, 6, 7, 8} ); |
| 320 | |
| 321 | testParseInto< std::vector<std::array<int, 4>> >( {arr,arr,arr} ); |
| 322 | |
| 323 | std::vector<int> v; |
| 324 | parse_into(v, "[1,2,3,4]"); |
| 325 | BOOST_TEST( v.size() == 4 ); |
| 326 | |
| 327 | parse_into(v, "[5,6,7]"); |
| 328 | BOOST_TEST( v.size() == 3 ); |
| 329 | } |
| 330 | |
| 331 | void testMap() |
| 332 | { |
nothing calls this directly
no test coverage detected