raft: add tests based on section 5.2 in raft paper

#1408 
ensure the state of r is Candidate before the actual test?