| 315 | // Works for: map, unordered_map, SortedHeapMap, unsorted_map_fixed, HashMapLru |
| 316 | template<typename MapContainer> |
| 317 | void test_map_move_semantics() { |
| 318 | auto ptr = make_shared_int(100); |
| 319 | |
| 320 | MapContainer source; |
| 321 | populate_map(source, 1, ptr); |
| 322 | |
| 323 | FL_REQUIRE(ptr.use_count() == 2); |
| 324 | FL_REQUIRE(source.size() == 1); |
| 325 | |
| 326 | MapContainer destination; |
| 327 | destination = fl::move(source); |
| 328 | |
| 329 | FL_CHECK(source.size() == 0); |
| 330 | FL_CHECK(source.empty()); |
| 331 | FL_CHECK(destination.size() == 1); |
| 332 | |
| 333 | // Retrieve and check value, but let it go out of scope immediately |
| 334 | { |
| 335 | auto retrieved = retrieve_map(destination, 1); |
| 336 | FL_CHECK(*retrieved == 100); |
| 337 | } |
| 338 | FL_CHECK(ptr.use_count() == 2); |
| 339 | |
| 340 | destination.clear(); |
| 341 | FL_CHECK(ptr.use_count() == 1); |
| 342 | } |
| 343 | |
| 344 | // Test smart pointer move semantics (unique_ptr, shared_ptr, optional, variant, expected) |
| 345 | template<typename SmartPtr> |
nothing calls this directly
no test coverage detected