Align pause resume and abort lifecycle

This commit is contained in:
2026-09-01 21:12:52 +08:00
parent 3dcd2d681f
commit 1342cff3f0
5 changed files with 56 additions and 28 deletions

View File

@@ -15,12 +15,15 @@ int main(void) {
assert(sim_protocol_last_seq() == 4);
assert(sim_protocol_accept(1, 5, "PROGRAM_PAUSE", "op-4", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 6, "MDI_EXECUTE", "op-5", 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 6, "PROGRAM_RESUME", "op-5", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(2, 7, "PING", NULL, 2) == SIM_PROTOCOL_ERR_SCHEMA);
assert(sim_protocol_accept(1, 7, "PING", NULL, 1) == SIM_PROTOCOL_ERR_TICK);
assert(sim_protocol_accept(1, 7, "DESTROY", NULL, 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 8, "PING", NULL, 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 9, "RESET", "reset-1", 0) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 6, "PROGRAM_ABORT", "op-5", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_state_value() == SIM_PROTOCOL_READY);
assert(sim_protocol_accept(1, 7, "PROGRAM_PAUSE", "op-6", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 8, "PROGRAM_RESUME", "op-7", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(2, 9, "PING", NULL, 2) == SIM_PROTOCOL_ERR_SCHEMA);
assert(sim_protocol_accept(1, 9, "PING", NULL, 1) == SIM_PROTOCOL_ERR_TICK);
assert(sim_protocol_accept(1, 9, "DESTROY", NULL, 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 10, "PING", NULL, 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 11, "RESET", "reset-1", 0) == SIM_PROTOCOL_OK);
assert(sim_protocol_state_value() == SIM_PROTOCOL_NEW);
assert(sim_protocol_set_tick(4) == SIM_PROTOCOL_ERR_TICK);
return 0;