Skip to content

Split tests/fl/stl/string.cpp (6,468 LOC) into 9 files of <1K LOC each (sub-issue of #3127) #3131

Closed

Description

@zackees

Tracked by #3127.

Goal

Split tests/fl/stl/string.cpp (6,468 LOC, 216 kB) into 9 files of <1K LOC each. Each new file gets its own FL_TEST_FILE(FL_FILEPATH) block.

Split table

New file Source range (current line nums) Approx LOC
tests/fl/stl/string_basic_a.cpp 1–2283 (str.cpp section: basic ops, reserve, find/rfind, find_first_of, find_last_of through find_last_not_of) ~870
tests/fl/stl/string_basic_b.cpp 2284–3129 (str.cpp section continued: reverse iterators, compare, comparison operators) ~840
tests/fl/stl/string_comprehensive.cpp 3130–3896 ~770
tests/fl/stl/string_memory_bugs.cpp 3897–4271 ~370
tests/fl/stl/string_optimization.cpp 4272–4727 ~460
tests/fl/stl/string_type_erased.cpp 4728–4922 (basic_string COW/move/inline-to-heap) ~195
tests/fl/stl/string_append_concat.cpp 4923–5230 ~310
tests/fl/stl/string_comparison_hash.cpp 5231–5500 ~270
tests/fl/stl/string_ctor_iterator.cpp 5501–6468 ~970

After the split, the original string.cpp is deleted.

Approach

All // SECTION: headers in the current file map 1:1 to targets. The 0–3129 range is the only one that needs an internal split — splitting it at line 2284 (FL_TEST_CASE("string reverse iterators")) lands two ~850-line files. Both halves are part of the legacy str.cpp section but the natural boundary is the iterator/compare divide.

Unlike fixed_point.cpp (sub-issue for #3127), there is no shared header to extract — these are pure tests with no cross-file dependencies. Each new .cpp just needs the standard prelude:

#include "fl/stl/string.h"
#include "fl/stl/...other headers used by this section..."
#include "test.h"

FL_TEST_FILE(FL_FILEPATH) {
  using namespace fl;
  // ... tests for this section ...
}

PR plan

Each PR removes one section from string.cpp and adds the corresponding new file:

  1. PR 1: Extract string_memory_bugs.cpp (lines 3897–4271, ~370 LOC — smallest, least risk). Verify bash test --cpp green.
  2. PR 2: Extract string_type_erased.cpp (lines 4728–4922, ~195 LOC).
  3. PR 3: Extract string_optimization.cpp (lines 4272–4727, ~460 LOC).
  4. PR 4: Extract string_comparison_hash.cpp (lines 5231–5500, ~270 LOC).
  5. PR 5: Extract string_append_concat.cpp (lines 4923–5230, ~310 LOC).
  6. PR 6: Extract string_comprehensive.cpp (lines 3130–3896, ~770 LOC).
  7. PR 7: Extract string_basic_a.cpp (lines 1–2283, ~870 LOC).
  8. PR 8: Extract string_basic_b.cpp (lines 2284–3129, ~840 LOC).
  9. PR 9: Extract string_ctor_iterator.cpp (lines 5501–6468, ~970 LOC); delete the now-empty string.cpp.

Order is "smallest first" to validate the pattern before committing to the larger extractions. PR 9 carries the Closes #<this-issue> keyword.

Acceptance criteria

  • All 9 PRs land, each green on CI.
  • Original string.cpp deleted in PR 9.
  • Every tests/fl/stl/string*.cpp < 1,000 LOC after split.
  • bash test --cpp green at every step.
  • No FL_TEST_CASE lost or renamed.

Notes

  • Per-file includes: be careful to include only what each section needs. string_optimization.cpp likely needs <thread.h> for the thread-safety tests; string_comprehensive.cpp may need <unordered_set.h> and <vector.h>. Use a grep over the section's source range to identify each file's needed includes — don't blindly copy the master include list.
  • The string file currently has a single FL_TEST_FILE(FL_FILEPATH) { block wrapping everything. Each new file gets its own block; the section markers (//=== SECTION:) inside don't need to be preserved across split (the filename now communicates section identity).

Activity

  1. added
    type: feature
    priority: medium
    area: ci
    on Jun 16, 2026
  2. added 18 commits that reference this issue on Jun 16, 2026
  3. moved this from Triage to Done in FastLED Trackeron Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cipriority: mediumtype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions