| 311 | // ---------------------------------------------------------------------------------------- |
| 312 | |
| 313 | void test_make_from_tuple() |
| 314 | { |
| 315 | struct multi_args_object |
| 316 | { |
| 317 | multi_args_object(int i_, int j_) : i(i_), j(j_) {} |
| 318 | int i = 0; |
| 319 | int j = 0; |
| 320 | }; |
| 321 | |
| 322 | { |
| 323 | auto obj = dlib::make_from_tuple<multi_args_object>(std::make_tuple(1, 2)); |
| 324 | static_assert(std::is_same<decltype(obj), multi_args_object>::value, "bad type"); |
| 325 | DLIB_TEST(obj.i == 1); |
| 326 | DLIB_TEST(obj.j == 2); |
| 327 | } |
| 328 | |
| 329 | { |
| 330 | std::array<int,2> a = {3, 4}; |
| 331 | auto obj = dlib::make_from_tuple<multi_args_object>(a); |
| 332 | static_assert(std::is_same<decltype(obj), multi_args_object>::value, "bad type"); |
| 333 | DLIB_TEST(obj.i == 3); |
| 334 | DLIB_TEST(obj.j == 4); |
| 335 | } |
| 336 | |
| 337 | { |
| 338 | auto obj = dlib::make_from_tuple<multi_args_object>(std::make_pair(5, 6)); |
| 339 | static_assert(std::is_same<decltype(obj), multi_args_object>::value, "bad type"); |
| 340 | DLIB_TEST(obj.i == 5); |
| 341 | DLIB_TEST(obj.j == 6); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // ---------------------------------------------------------------------------------------- |
| 346 |
no test coverage detected