| 776 | // Verifies: begin/end, forward iteration, const iteration |
| 777 | template<template<typename, typename> class MapTemplate> |
| 778 | void test_map_iterators() { |
| 779 | using MapContainer = MapTemplate<int, fl::shared_ptr<int>>; |
| 780 | |
| 781 | auto ptr1 = make_shared_int(10); |
| 782 | auto ptr2 = make_shared_int(20); |
| 783 | auto ptr3 = make_shared_int(30); |
| 784 | |
| 785 | MapContainer source; |
| 786 | populate_map(source, 1, ptr1); |
| 787 | populate_map(source, 2, ptr2); |
| 788 | populate_map(source, 3, ptr3); |
| 789 | |
| 790 | // Test mutable iterators exist |
| 791 | FL_CHECK(source.begin() != source.end()); |
| 792 | |
| 793 | // Test const iterators via const reference |
| 794 | const auto& const_source = source; |
| 795 | FL_CHECK(const_source.begin() != const_source.end()); |
| 796 | |
| 797 | // Test iteration - count elements |
| 798 | int count = 0; |
| 799 | for (auto it = source.begin(); it != source.end(); ++it) { |
| 800 | count++; |
| 801 | } |
| 802 | FL_CHECK(count == 3); |
| 803 | |
| 804 | // Move and verify source is empty via iterators |
| 805 | MapContainer destination = fl::move(source); |
| 806 | FL_CHECK(source.begin() == source.end()); // Empty after move |
| 807 | const auto& const_empty = source; |
| 808 | FL_CHECK(const_empty.begin() == const_empty.end()); |
| 809 | FL_CHECK(destination.begin() != destination.end()); // Has elements |
| 810 | } |
| 811 | |
| 812 | // Test reverse iterator support for map containers |
| 813 | // Verifies: rbegin/rend work correctly |
nothing calls this directly
no test coverage detected