| 962 | // Verifies: insert returns valid iterator, erase returns next iterator |
| 963 | template<template<typename, typename> class MapTemplate> |
| 964 | void test_map_insert_erase_iterators() { |
| 965 | using MapContainer = MapTemplate<int, fl::shared_ptr<int>>; |
| 966 | |
| 967 | MapContainer m; |
| 968 | populate_map(m, 5, make_shared_int(50)); |
| 969 | populate_map(m, 15, make_shared_int(150)); |
| 970 | |
| 971 | // Insert and get iterator |
| 972 | auto result = m.insert(fl::pair<int, fl::shared_ptr<int>>(10, make_shared_int(100))); |
| 973 | FL_CHECK(result.second == true); // insertion took place |
| 974 | FL_CHECK(result.first != m.end()); |
| 975 | FL_CHECK(result.first->first == 10); |
| 976 | |
| 977 | // Erase and verify next iterator |
| 978 | auto erase_result = m.erase(result.first); |
| 979 | // After erase, either at end or the key should be > 10 |
| 980 | bool valid = (erase_result == m.end()); |
| 981 | if (!valid) { |
| 982 | valid = erase_result->first > 10; |
| 983 | } |
| 984 | FL_CHECK(valid); |
| 985 | |
| 986 | FL_CHECK(m.size() == 2); // Two elements left |
| 987 | } |
| 988 | |
| 989 | // Test count and contains |
| 990 | // Verifies: key lookup operations work correctly |
nothing calls this directly
no test coverage detected