Repository navigation
Description
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:
- PR 1: Extract
string_memory_bugs.cpp(lines 3897–4271, ~370 LOC — smallest, least risk). Verifybash test --cppgreen. - PR 2: Extract
string_type_erased.cpp(lines 4728–4922, ~195 LOC). - PR 3: Extract
string_optimization.cpp(lines 4272–4727, ~460 LOC). - PR 4: Extract
string_comparison_hash.cpp(lines 5231–5500, ~270 LOC). - PR 5: Extract
string_append_concat.cpp(lines 4923–5230, ~310 LOC). - PR 6: Extract
string_comprehensive.cpp(lines 3130–3896, ~770 LOC). - PR 7: Extract
string_basic_a.cpp(lines 1–2283, ~870 LOC). - PR 8: Extract
string_basic_b.cpp(lines 2284–3129, ~840 LOC). - PR 9: Extract
string_ctor_iterator.cpp(lines 5501–6468, ~970 LOC); delete the now-emptystring.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.cppdeleted in PR 9. - Every
tests/fl/stl/string*.cpp< 1,000 LOC after split. -
bash test --cppgreen at every step. - No
FL_TEST_CASElost or renamed.
Notes
- Per-file includes: be careful to include only what each section needs.
string_optimization.cpplikely needs<thread.h>for the thread-safety tests;string_comprehensive.cppmay 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).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
refactor(tests): extract string_memory_bugs.cpp from string.cpp (part…
refactor(tests): extract string_memory_bugs.cpp from string.cpp (part…
refactor(tests): extract string_type_erased.cpp from string.cpp (part…
refactor(tests): extract string_type_erased.cpp from string.cpp (part…
refactor(tests): extract string_append_concat.cpp from string.cpp (pa…
refactor(tests): extract string_append_concat.cpp from string.cpp (pa…
refactor(tests): extract string_comparison_hash.cpp from string.cpp (…
refactor(tests): extract string_comparison_hash.cpp from string.cpp (…
refactor(tests): extract string_optimization.cpp from string.cpp (par…
refactor(tests): extract string_optimization.cpp from string.cpp (par…
refactor(tests): extract string_comprehensive.cpp from string.cpp (pa…
refactor(tests): extract string_comprehensive.cpp from string.cpp (pa…
refactor(tests): extract string_ctor_iterator.cpp from string.cpp (pa…
refactor(tests): extract string_ctor_iterator.cpp from string.cpp (pa…
refactor(tests): extract string_basic_b.cpp from string.cpp (part of #…
refactor(tests): extract string_basic_b.cpp from string.cpp (part of #…
refactor(tests): split string.cpp basic_a section into 3 files + dele…
refactor(tests): split string.cpp basic_a section into 3 files + dele…