feat(raft-library): task 5.1 — protocol Groups A+B, 10 test cases (election + voted_for)

This commit is contained in:
Rongsong Shen 2026-05-31 06:26:52 +00:00
parent c1b07392df
commit 389047194f
2 changed files with 317 additions and 1 deletions

View file

@ -88,7 +88,7 @@
- [ ] 5. Protocol-level test suite (test_raft.c)
_Depends: 4_
- [ ] 5.1 Test Groups A and B: basic election correctness and voted_for invariant (10 cases)
- [x] 5.1 Test Groups A and B: basic election correctness and voted_for invariant (10 cases)
- A1: single-node cluster → LEADER immediately; `on_become_leader` fires once; no `on_send_vote_request` calls
- A2: 3-node simultaneous election → `leader_count == 1` after `raft_sim_deliver_pending`
- A3: node 0 wins, node 1 starts late election same term → node 1 denied; total `leader_count` stays 1