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

Function test_map_front_back

tests/misc/containers.cpp:593–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591// Front and back element access for map containers
592template<typename Map>
593void test_map_front_back() {
594 Map m;
595 m.insert(fl::make_pair(1, 100));
596 m.insert(fl::make_pair(2, 200));
597 m.insert(fl::make_pair(3, 300));
598
599 // For sorted maps (flat_map, map), elements are ordered by key
600 // front() should give the element with smallest key
601 // back() should give the element with largest key
602 auto front_pair = m.front();
603 auto back_pair = m.back();
604
605 FL_CHECK(front_pair.first == 1);
606 FL_CHECK(front_pair.second == 100);
607 FL_CHECK(back_pair.first == 3);
608 FL_CHECK(back_pair.second == 300);
609}
610
611// Move-tracking item that allows copies but tracks them.
612// Unlike TestItem (which deletes copies), this type lets us verify that

Callers

nothing calls this directly

Calls 4

make_pairFunction · 0.85
insertMethod · 0.45
frontMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected