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

Function test_map_iteration_order

tests/test_container_helpers.h:1030–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1028// Verifies: elements are visited in key order
1029template<template<typename, typename> class MapTemplate>
1030void test_map_iteration_order() {
1031 using MapContainer = MapTemplate<int, fl::shared_ptr<int>>;
1032
1033 MapContainer m;
1034 populate_map(m, 30, make_shared_int(3));
1035 populate_map(m, 10, make_shared_int(1));
1036 populate_map(m, 20, make_shared_int(2));
1037
1038 // Collect keys in iteration order
1039 int prev_key = -1;
1040 int last_key = -1;
1041 for (auto it = m.begin(); it != m.end(); ++it) {
1042 int current_key = it->first;
1043 bool ascending = current_key > prev_key;
1044 FL_CHECK(ascending); // Keys in ascending order
1045 prev_key = current_key;
1046 last_key = current_key;
1047 }
1048 FL_CHECK(last_key == 30); // Last key was 30
1049}
1050
1051} // namespace test_helpers

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