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

Function test_container_iterators_with_shared_ptr

tests/test_container_helpers.h:367–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365// Verifies: begin/end, forward iteration, const iteration, move leaves empty
366template<typename Container>
367void test_container_iterators_with_shared_ptr() {
368 auto ptr1 = make_shared_int(10);
369 auto ptr2 = make_shared_int(20);
370 auto ptr3 = make_shared_int(30);
371
372 Container source;
373 populate(source, ptr1);
374 populate(source, ptr2);
375 populate(source, ptr3);
376
377 // Test mutable iterators exist
378 FL_CHECK(source.begin() != source.end());
379
380 // Test const iterators via const reference
381 const auto& const_source = source;
382 FL_CHECK(const_source.begin() != const_source.end());
383
384 // Move and verify source is empty via iterators
385 Container destination = fl::move(source);
386 FL_CHECK(source.begin() == source.end()); // Empty after move
387 const auto& const_empty = source;
388 FL_CHECK(const_empty.begin() == const_empty.end());
389 FL_CHECK(destination.begin() != destination.end()); // Has elements
390}
391
392// Test reverse iterator support for bidirectional containers
393// Verifies: rbegin/rend exist and work correctly after move

Callers

nothing calls this directly

Calls 4

make_shared_intFunction · 0.85
populateFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected