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

Function test_container_capacity_management

tests/test_container_helpers.h:664–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662// Test capacity management for heap-based containers
663template<typename Container>
664void test_container_capacity_management() {
665 Container c;
666
667 // Test initial capacity - COMPILER ERROR if capacity() doesn't exist
668 FL_CHECK(c.capacity() >= 0);
669
670 // Test reserve - COMPILER ERROR if reserve() doesn't exist
671 c.reserve(100);
672 FL_CHECK(c.capacity() >= 100);
673 FL_CHECK(c.size() == 0); // Size unchanged
674
675 // Populate without reallocation
676 for (int i = 0; i < 50; ++i) {
677 populate(c, make_shared_int(i));
678 }
679 FL_CHECK(c.size() == 50);
680 FL_CHECK(c.capacity() >= 100);
681}
682
683// Test shrink_to_fit for heap-based containers
684template<typename Container>

Callers

nothing calls this directly

Calls 5

populateFunction · 0.85
make_shared_intFunction · 0.85
capacityMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected