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

Function test_map_operator_bracket_access

tests/test_container_helpers.h:1010–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008// Verifies: operator[] allows modification through iterator dereferencing
1009template<template<typename, typename> class MapTemplate>
1010void test_map_operator_bracket_access() {
1011 using MapContainer = MapTemplate<int, fl::shared_ptr<int>>;
1012
1013 MapContainer m;
1014 auto original = make_shared_int(111);
1015 populate_map(m, 1, original);
1016
1017 // Verify value through operator[]
1018 FL_CHECK(*m[1] == 111);
1019
1020 // Modify through iterator
1021 auto it = m.find(1);
1022 FL_CHECK(it != m.end());
1023 it->second = make_shared_int(222);
1024 FL_CHECK(*m[1] == 222);
1025}
1026
1027// Test iteration order (for sorted maps)
1028// Verifies: elements are visited in key order

Callers

nothing calls this directly

Calls 4

make_shared_intFunction · 0.85
populate_mapFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected