Skip to content

fl_stl_string: 2 pre-existing failures on master (ftoa precision + substr test-data bug) #2970

Closed

Description

@zackees

Summary

bash test fl_stl_string --cpp fails with 2 cases on master. Found while reviewing CI failures on PR #2968 — confirmed these failures reproduce on master (no changes to src/fl/stl/string.* or tests/fl/stl/string.cpp between master and the PR branch).

Failure 1: `fl::ftoa` drops trailing zero at precision=2

`tests/fl/stl/string.cpp:5018` "fl::string - append float and double":

```
FAIL: fl::string - append float and double at tests/fl/stl/string.cpp:5018
tests/fl/stl/string.cpp:5022: 0.0 == 0.00
tests/fl/stl/string.cpp:5026: 1.0 == 1.00
tests/fl/stl/string.cpp:5043: 0.0 == 0.00
tests/fl/stl/string.cpp:5047: 1.0 == 1.00
```

`basic_string::append(const float& val)` calls `fl::ftoa(val, buf, 2)` (precision=2). Test expects "0.00"/"1.00" but `fl::ftoa` returns "0.0"/"1.0" for integer-valued floats — appears to strip trailing zeros even when an explicit precision is requested.

Fix: `fl::ftoa` should honor the precision arg and pad trailing zeros. Check `src/fl/stl/charconv.cpp` (or wherever `ftoa` lives).

Failure 2: Test data is exactly 64 chars, not >64

`tests/fl/stl/string.cpp:6225` "fl::string - substr/substring on heap-promoted string (>64 chars)":

```
FAIL: fl::string - substr/substring on heap-promoted string (>64 chars)
tests/fl/stl/string.cpp:6228: 64 > 64
```

```cpp
const char* long_prefix =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_X";
```

That's 26 + 10 + 26 + 2 = 64 chars exactly, which equals `FASTLED_STR_INLINED_SIZE` — so the string stays inline rather than heap-promoting. Test name says ">64" but data doesn't satisfy that, and the subsequent FL_CHECK_GT fires.

Fix: extend the prefix to 65+ chars, e.g. append "Y".

Source

Both look like collateral from #2961 (drop StrN template) or #2962 (boundary coverage) — that's when the inline buffer / append-float code paths were last touched. CI started reporting these failures on PRs that branched from master AFTER those merges landed.

Activity

  1. added a commit that references this issue on Jun 8, 2026
    116b906
  2. moved this from Triage to Done in FastLED Trackeron Jun 8, 2026
  3. added a commit that references this issue on Jun 8, 2026
    88e03dc
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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions