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

@ -1126,6 +1126,36 @@ sched_repl_output_compression_test = executable(
dependencies: [scheduler_deps, unity_dep],
install: false)
# Contract test for the REPL's resource-value byte/megabyte classification
# and adaptive human-scaling helpers (scheduler-sim-repl-verbosity spec, task
# 7.1, Requirement 6.1/6.2 "Human-Readable Resource Value Formatting").
# repl_is_bytes_valued_resource()/repl_format_bytes_human() are pure,
# self-contained formatters (design.md's "Resource Value Formatter"
# component) that -- like repl_fmt_jobid_range() above -- do not yet exist
# anywhere in this codebase (task 7.2, a separate later task, implements
# them); this test file declares them as plain externs rather than
# #include-ing repl.c, same rationale as
# repl_output_compression_test_srcs above (repl.c's own dependency surface
# pulls in undefined cross-references to sibling files this test does not
# need). Same "link the real scheduler_srcs object list instead of textually
# including one" technique, for the identical reason: task 7.2 has not
# landed yet, so this target is expected to fail at LINK time (undefined
# reference to both symbols) until it does -- that failure is task 7.1's own
# Observable evidence.
repl_resource_formatting_test_srcs = ['test_repl_resource_formatting.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
repl_resource_formatting_test_srcs += ['../' + f]
endif
endforeach
sched_repl_resource_formatting_test = executable(
'sched_repl_resource_formatting_test',
repl_resource_formatting_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
install: false)
# Tests for the scheduler's unified candidate-list connect/rejoin pipeline
# (component-failover-adoption, task 3.1, boundary: SchedulerControllerClient).
# Unlike the white-box #include-the-.c-file tests above, this target links
@ -1491,6 +1521,9 @@ test('scheduler repl equivalence test',
test('scheduler repl output compression test',
sched_repl_output_compression_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl resource formatting test',
sched_repl_resource_formatting_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler connect pipeline test',
sched_scheduler_connect_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])