feat(scheduler-sim-repl-verbosity): task 7.2 - implement resource formatting helpers
Implements repl_is_bytes_valued_resource()/repl_format_bytes_human() (mirroring xce_test's confirmed is_bytes_valued_resource()/ format_bytes_human() precedent exactly) and the units_mode setting (explicitly defaulted to both, not left to zero-init) wired into set units raw|human|both alongside the existing set speed/output/verify branches (Requirements 6.1-6.3). All 8 of task 7.1's tests pass. Split repl_format_ts_human(), the Jobid Range Compressor (task 1.2), and these two new helpers out of repl.c into a new repl_fmt.c: adding them in place pushed repl.c to 929 lines (16.1% over the 800-line cap), and unlike task 6.2's single-function split attempt (which didn't even achieve compliance), bundling these three pure-formatter groups together does - repl.c settles at 587 lines, repl_fmt.c at 402, both comfortably under cap. Required a matching #include line in the 20 test files that white-box #include repl.c, plus extending test_sim_isolation.c's forbidden-include/symbol scan to cover the new file, following the repl_rollup.c split precedent from task 2.2. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
parent
11fe6194ce
commit
5ee1d6cb08
29 changed files with 634 additions and 317 deletions
|
|
@ -447,6 +447,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
char* repl_int_h_raw = read_whole_file(XCE_SIM_REPL_INTERNAL_H_PATH);
|
||||
char* repl_params_c_raw = read_whole_file(XCE_SIM_REPL_PARAMS_C_PATH);
|
||||
char* repl_rollup_c_raw = read_whole_file(XCE_SIM_REPL_ROLLUP_C_PATH);
|
||||
char* repl_fmt_c_raw = read_whole_file(XCE_SIM_REPL_FMT_C_PATH);
|
||||
char* h;
|
||||
char* c;
|
||||
char* loop;
|
||||
|
|
@ -459,6 +460,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
char* repl_int_h;
|
||||
char* repl_params_c;
|
||||
char* repl_rollup_c;
|
||||
char* repl_fmt_c;
|
||||
|
||||
TEST_ASSERT_NOT_NULL(h_raw);
|
||||
TEST_ASSERT_NOT_NULL(c_raw);
|
||||
|
|
@ -472,6 +474,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
TEST_ASSERT_NOT_NULL(repl_int_h_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_params_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_rollup_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_fmt_c_raw);
|
||||
|
||||
h = strip_c_comments(h_raw);
|
||||
c = strip_c_comments(c_raw);
|
||||
|
|
@ -485,6 +488,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
repl_int_h = strip_c_comments(repl_int_h_raw);
|
||||
repl_params_c = strip_c_comments(repl_params_c_raw);
|
||||
repl_rollup_c = strip_c_comments(repl_rollup_c_raw);
|
||||
repl_fmt_c = strip_c_comments(repl_fmt_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(h);
|
||||
TEST_ASSERT_NOT_NULL(c);
|
||||
TEST_ASSERT_NOT_NULL(loop);
|
||||
|
|
@ -497,6 +501,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
TEST_ASSERT_NOT_NULL(repl_int_h);
|
||||
TEST_ASSERT_NOT_NULL(repl_params_c);
|
||||
TEST_ASSERT_NOT_NULL(repl_rollup_c);
|
||||
TEST_ASSERT_NOT_NULL(repl_fmt_c);
|
||||
|
||||
assert_no_forbidden_includes(h, "sim.h");
|
||||
assert_no_forbidden_includes(c, "sim.c");
|
||||
|
|
@ -510,6 +515,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
assert_no_forbidden_includes(repl_int_h, "repl_internal.h");
|
||||
assert_no_forbidden_includes(repl_params_c, "repl_params.c");
|
||||
assert_no_forbidden_includes(repl_rollup_c, "repl_rollup.c");
|
||||
assert_no_forbidden_includes(repl_fmt_c, "repl_fmt.c");
|
||||
|
||||
free(h_raw);
|
||||
free(c_raw);
|
||||
|
|
@ -523,6 +529,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
free(repl_int_h_raw);
|
||||
free(repl_params_c_raw);
|
||||
free(repl_rollup_c_raw);
|
||||
free(repl_fmt_c_raw);
|
||||
free(h);
|
||||
free(c);
|
||||
free(loop);
|
||||
|
|
@ -535,6 +542,7 @@ static void test_sim_never_includes_forbidden_headers(void)
|
|||
free(repl_int_h);
|
||||
free(repl_params_c);
|
||||
free(repl_rollup_c);
|
||||
free(repl_fmt_c);
|
||||
}
|
||||
|
||||
static void test_sim_never_calls_forbidden_symbols(void)
|
||||
|
|
@ -551,6 +559,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
char* repl_int_h_raw = read_whole_file(XCE_SIM_REPL_INTERNAL_H_PATH);
|
||||
char* repl_params_c_raw = read_whole_file(XCE_SIM_REPL_PARAMS_C_PATH);
|
||||
char* repl_rollup_c_raw = read_whole_file(XCE_SIM_REPL_ROLLUP_C_PATH);
|
||||
char* repl_fmt_c_raw = read_whole_file(XCE_SIM_REPL_FMT_C_PATH);
|
||||
char* h;
|
||||
char* c;
|
||||
char* loop;
|
||||
|
|
@ -563,6 +572,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
char* repl_int_h;
|
||||
char* repl_params_c;
|
||||
char* repl_rollup_c;
|
||||
char* repl_fmt_c;
|
||||
|
||||
TEST_ASSERT_NOT_NULL(h_raw);
|
||||
TEST_ASSERT_NOT_NULL(c_raw);
|
||||
|
|
@ -576,6 +586,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
TEST_ASSERT_NOT_NULL(repl_int_h_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_params_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_rollup_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(repl_fmt_c_raw);
|
||||
|
||||
h = strip_c_comments(h_raw);
|
||||
c = strip_c_comments(c_raw);
|
||||
|
|
@ -589,6 +600,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
repl_int_h = strip_c_comments(repl_int_h_raw);
|
||||
repl_params_c = strip_c_comments(repl_params_c_raw);
|
||||
repl_rollup_c = strip_c_comments(repl_rollup_c_raw);
|
||||
repl_fmt_c = strip_c_comments(repl_fmt_c_raw);
|
||||
TEST_ASSERT_NOT_NULL(h);
|
||||
TEST_ASSERT_NOT_NULL(c);
|
||||
TEST_ASSERT_NOT_NULL(loop);
|
||||
|
|
@ -601,6 +613,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
TEST_ASSERT_NOT_NULL(repl_int_h);
|
||||
TEST_ASSERT_NOT_NULL(repl_params_c);
|
||||
TEST_ASSERT_NOT_NULL(repl_rollup_c);
|
||||
TEST_ASSERT_NOT_NULL(repl_fmt_c);
|
||||
|
||||
assert_no_forbidden_symbols(h, "sim.h");
|
||||
assert_no_forbidden_symbols(c, "sim.c");
|
||||
|
|
@ -614,6 +627,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
assert_no_forbidden_symbols(repl_int_h, "repl_internal.h");
|
||||
assert_no_forbidden_symbols(repl_params_c, "repl_params.c");
|
||||
assert_no_forbidden_symbols(repl_rollup_c, "repl_rollup.c");
|
||||
assert_no_forbidden_symbols(repl_fmt_c, "repl_fmt.c");
|
||||
|
||||
free(h_raw);
|
||||
free(c_raw);
|
||||
|
|
@ -627,6 +641,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
free(repl_int_h_raw);
|
||||
free(repl_params_c_raw);
|
||||
free(repl_rollup_c_raw);
|
||||
free(repl_fmt_c_raw);
|
||||
free(h);
|
||||
free(c);
|
||||
free(loop);
|
||||
|
|
@ -639,6 +654,7 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
free(repl_int_h);
|
||||
free(repl_params_c);
|
||||
free(repl_rollup_c);
|
||||
free(repl_fmt_c);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue