MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_map_reverse_iterators

Function test_map_reverse_iterators

tests/test_container_helpers.h:815–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

813// Verifies: rbegin/rend work correctly
814template<template<typename, typename> class MapTemplate>
815void test_map_reverse_iterators() {
816 using MapContainer = MapTemplate<int, fl::shared_ptr<int>>;
817
818 MapContainer source;
819 populate_map(source, 1, make_shared_int(10));
820 populate_map(source, 2, make_shared_int(20));
821 populate_map(source, 3, make_shared_int(30));
822
823 // Test reverse iterators exist
824 FL_CHECK(source.rbegin() != source.rend());
825
826 // Count reverse iteration
827 int count = 0;
828 for (auto rit = source.rbegin(); rit != source.rend(); ++rit) {
829 count++;
830 }
831 FL_CHECK(count == 3);
832
833 // Move and verify
834 MapContainer destination = fl::move(source);
835 FL_CHECK(source.rbegin() == source.rend()); // Empty
836 FL_CHECK(destination.rbegin() != destination.rend());
837}
838
839// Test iterator arithmetic for RandomAccessIterator maps (like flat_map)
840// Verifies: operator+, operator-, distance calculations

Callers

nothing calls this directly

Calls 4

populate_mapFunction · 0.85
make_shared_intFunction · 0.85
rbeginMethod · 0.45
rendMethod · 0.45

Tested by

no test coverage detected