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

Function test_map_iterator_arithmetic

tests/test_container_helpers.h:842–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840// Verifies: operator+, operator-, distance calculations
841template<template<typename, typename> class MapTemplate>
842void test_map_iterator_arithmetic() {
843 using MapContainer = MapTemplate<int, fl::shared_ptr<int>>;
844
845 MapContainer c;
846 populate_map(c, 1, make_shared_int(10));
847 populate_map(c, 2, make_shared_int(20));
848 populate_map(c, 3, make_shared_int(30));
849
850 // Test operator+ on iterators
851 auto it0 = c.begin();
852 auto it1 = c.begin() + 1;
853 auto it2 = c.begin() + 2;
854
855 FL_CHECK(it1 - it0 == 1); // Distance check
856 FL_CHECK(it2 - it0 == 2);
857 FL_CHECK(it1 != it0);
858 FL_CHECK(it1 != it2);
859}
860
861// Test map iteration with key-value access
862// Verifies: pair<Key, Value> dereferencing

Callers

nothing calls this directly

Calls 3

populate_mapFunction · 0.85
make_shared_intFunction · 0.85
beginMethod · 0.45

Tested by

no test coverage detected