feat(scheduler-sim-repl-verbosity): task 7.1 - RED-phase resource formatting tests

Adds 5 pure-function tests in a new test_repl_resource_formatting.c
for repl_is_bytes_valued_resource()/repl_format_bytes_human()
(classification, adaptive B/KB/MB/GB/TB/PB scaling including exact
boundary values, swp's MB->bytes conversion), and 3 tests in
test_repl_snapshot_params.c for set units raw|human|both parsing
(Requirements 6.1-6.3). All fail as expected: link failure for the
not-yet-existing helpers, compile failure for the not-yet-existing
units_mode field/enum.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
Rongsong Shen 2026-09-02 16:45:59 +00:00
parent da6ba96eb4
commit 11fe6194ce
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 495 additions and 1 deletions

View file

@ -72,7 +72,7 @@
- _Boundary: REPL Prompt Context_
- [ ] 7. (P) Resource value classification, human-readable scaling, and the `set units` option
- [ ] 7.1 (P) Write failing tests for byte/megabyte classification, adaptive scaling, and `set units` parsing
- [x] 7.1 (P) Write failing tests for byte/megabyte classification, adaptive scaling, and `set units` parsing
- Cover: the bytes-valued classifier returns true only for `mem`/`tmp`/`maxmem`/`maxtmp`/`maxswap` and false for `swp`, unitless resources, and unknown names; the scaling helper adaptively renders across B/KB/MB/GB/TB, including exact unit-boundary values; `swp`'s value is converted MB→bytes before scaling; `set units raw`/`human`/`both` each update the display-mode setting, defaulting to `both`; an unrecognized `set units` value is rejected the same way other unrecognized `set` parameters already are
- Observable: the new test cases fail against the current codebase, which has neither the classifier/scaling helpers nor a `units` setting
- _Requirements: 6.1, 6.2, 6.3_