test(scheduler-sim-repl-verbosity): task 9.1 - RED tests for help/break discoverability
Adds failing tests for Requirement 7 (Discoverable Help and Breakpoint Event Types): help's four labeled sections in correct order, one consistent column width across every listed command, info config's placement alongside its info siblings, set units's placement alongside set speed/output/verify, the break line's complete BP_KIND_TABLE-derived event-type listing, and break's own unrecognized-event-type error listing the same complete set. Each new test hardcodes BP_KIND_TABLE's current 12 tokens rather than referencing the not-yet-implemented repl_bp_kind_names() accessor, so RED comes from genuine assertion failures against today's behavior rather than a link error. New tests for Requirements 7.1-7.4 land in a new test_repl_help.c rather than test_repl_execution_control.c (949 lines going in, within reach of this spec's own ~1000-line split trigger already flagged at task 2.1) - proactive split per this spec's established practice, documented in design.md. break's Requirement 7.5 error-message test lands in test_repl_breakpoints_inspection.c exactly as originally planned, alongside the pre-existing test_break_unrecognized_event_type_rejected (left unmodified). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
parent
9db99964f0
commit
bd77eea0a8
5 changed files with 657 additions and 1 deletions
|
|
@ -351,6 +351,66 @@ static void test_break_unrecognized_event_type_rejected(void)
|
|||
printf("test_break_unrecognized_event_type_rejected: PASS\n");
|
||||
}
|
||||
|
||||
/* BP_KIND_TABLE's complete token set (repl_break.c), duplicated here in
|
||||
* table order -- scheduler-sim-repl-verbosity spec, task 9.1, Requirement
|
||||
* 7.5: `break`'s unrecognized-event-type error message must list the
|
||||
* complete, current set of valid event types, from the same source
|
||||
* (BP_KIND_TABLE, via task 9.2's not-yet-existing repl_bp_kind_names()
|
||||
* accessor) that help's own `break` line (test_repl_help.c) lists. Kept as
|
||||
* a plain literal list here rather than a call into that accessor
|
||||
* deliberately: this is a RED-phase test written before task 9.2 adds it --
|
||||
* referencing it now would make this file fail to LINK rather than fail an
|
||||
* assertion, the wrong kind of RED failure for this task. */
|
||||
static const char* BP_KIND_TOKENS_9_1[] = {
|
||||
"CONFIG_PUSH", "JOB_PUSH", "WORKERS_PUSH",
|
||||
"RESOURCES_PUSH", "RESVALS_FULL", "RESVALS_DELTA",
|
||||
"JOB_STATE_CHANGE", "JOB_UPDATE", "QUEUE_UPDATE",
|
||||
"JOB_RUSAGE", "BEGIN_ROUND", "DECISION",
|
||||
};
|
||||
#define NUM_BP_KIND_TOKENS_9_1 \
|
||||
(sizeof(BP_KIND_TOKENS_9_1) / sizeof(BP_KIND_TOKENS_9_1[0]))
|
||||
|
||||
static void
|
||||
test_break_unrecognized_event_type_error_lists_all_valid_event_types(void)
|
||||
{
|
||||
xce_sched_sim_driver_t sim;
|
||||
char* captured;
|
||||
size_t i;
|
||||
|
||||
memset(&sim, 0, sizeof(sim));
|
||||
/* Same precondition every Group A test in this file establishes -- see
|
||||
* test_break_creates_breakpoint_with_filters()'s own comment above. */
|
||||
TEST_ASSERT_EQUAL_INT(0, xce_sched_core_init(&(sim.core)));
|
||||
sim.repl_state = repl_state_ensure(&sim);
|
||||
TEST_ASSERT_NOT_NULL(sim.repl_state);
|
||||
|
||||
captured = capture_dispatch(&sim, "break BOGUS_EVENT_TYPE");
|
||||
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(
|
||||
strstr(captured, "unrecognized event type"),
|
||||
"the existing 'unrecognized event type' error text must still "
|
||||
"appear (Requirement 7.6 -- no other command output changes)");
|
||||
|
||||
for (i = 0; i < NUM_BP_KIND_TOKENS_9_1; i++) {
|
||||
char msg[96];
|
||||
|
||||
snprintf(msg, sizeof(msg),
|
||||
"break's unrecognized-event-type error must list '%s' "
|
||||
"among the complete set of valid event types (Requirement "
|
||||
"7.5)",
|
||||
BP_KIND_TOKENS_9_1[i]);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(strstr(captured, BP_KIND_TOKENS_9_1[i]),
|
||||
msg);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, sim.repl_state->nbreakpoints);
|
||||
|
||||
free(captured);
|
||||
|
||||
printf("test_break_unrecognized_event_type_error_lists_all_valid_"
|
||||
"event_types: PASS\n");
|
||||
}
|
||||
|
||||
static void test_break_malformed_filter_rejected(void)
|
||||
{
|
||||
xce_sched_sim_driver_t sim;
|
||||
|
|
@ -2059,6 +2119,8 @@ int main(void)
|
|||
|
||||
RUN_TEST(test_break_creates_breakpoint_with_filters);
|
||||
RUN_TEST(test_break_unrecognized_event_type_rejected);
|
||||
RUN_TEST(
|
||||
test_break_unrecognized_event_type_error_lists_all_valid_event_types);
|
||||
RUN_TEST(test_break_malformed_filter_rejected);
|
||||
RUN_TEST(test_delete_by_id_removes_one_breakpoint);
|
||||
RUN_TEST(test_delete_all_removes_all_breakpoints);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue