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

Function test_map_iteration_key_value

tests/test_container_helpers.h:864–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862// Verifies: pair<Key, Value> dereferencing
863template<template<typename, typename> class MapTemplate>
864void test_map_iteration_key_value() {
865 using MapContainer = MapTemplate<int, fl::shared_ptr<int>>;
866
867 MapContainer m;
868 populate_map(m, 100, make_shared_int(1000));
869 populate_map(m, 200, make_shared_int(2000));
870
871 int key_sum = 0;
872 int value_sum = 0;
873
874 for (auto it = m.begin(); it != m.end(); ++it) {
875 key_sum += it->first;
876 value_sum += *it->second;
877 }
878
879 FL_CHECK(key_sum == 300); // 100 + 200
880 FL_CHECK(value_sum == 3000); // 1000 + 2000
881}
882
883// Test map lookup and iteration consistency
884// Verifies: find() returns valid iterator, dereferencing works

Callers

nothing calls this directly

Calls 4

populate_mapFunction · 0.85
make_shared_intFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected