Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JSHan94 committed Oct 15, 2023
1 parent 73ff4c9 commit fd3b1e4
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions vetomint/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ mod tests {
#[test]
fn get_total_prevotes() {
let mut consensus_state = create_default_consensus_state();
consensus_state.prevotes.insert(Vote{
proposal:None,
signer:0,
round:0,
consensus_state.prevotes.insert(Vote {
proposal: None,
signer: 0,
round: 0,
});

let total_prevotes_round = consensus_state.get_total_prevotes(0);;
let total_prevotes_round = consensus_state.get_total_prevotes(0);
assert_eq!(total_prevotes_round, 1, "total precommits should be 1");

consensus_state.prevotes.insert(Vote{
proposal:None,
signer:1,
round:0,
consensus_state.prevotes.insert(Vote {
proposal: None,
signer: 1,
round: 0,
});

let total_prevotes_round = consensus_state.get_total_prevotes(0);
Expand Down Expand Up @@ -207,9 +207,12 @@ mod tests {
signer: 0,
round: 0,
});

let total_prevotes_on_proposal = consensus_state.get_total_prevotes_on_proposal(0, 0);
assert_eq!(total_prevotes_on_proposal, 1, "total prevotes on proposal should be 1");
assert_eq!(
total_prevotes_on_proposal, 1,
"total prevotes on proposal should be 1"
);

consensus_state.prevotes.insert(Vote {
proposal: Some(0),
Expand All @@ -218,7 +221,10 @@ mod tests {
});

let total_prevotes_on_proposal = consensus_state.get_total_prevotes_on_proposal(0, 0);
assert_eq!(total_prevotes_on_proposal, 2, "total prevotes on proposal should be 2");
assert_eq!(
total_prevotes_on_proposal, 2,
"total prevotes on proposal should be 2"
);
}

#[test]
Expand All @@ -231,7 +237,10 @@ mod tests {
});

let total_precommits_on_proposal = consensus_state.get_total_precommits_on_proposal(0, 0);
assert_eq!(total_precommits_on_proposal, 1, "total precommits on proposal should be 1");
assert_eq!(
total_precommits_on_proposal, 1,
"total precommits on proposal should be 1"
);

consensus_state.precommits.insert(Vote {
proposal: Some(0),
Expand All @@ -240,7 +249,10 @@ mod tests {
});

let total_precommits_on_proposal = consensus_state.get_total_precommits_on_proposal(0, 0);
assert_eq!(total_precommits_on_proposal, 2, "total precommits on proposal should be 2");
assert_eq!(
total_precommits_on_proposal, 2,
"total precommits on proposal should be 2"
);
}

#[test]
Expand All @@ -253,7 +265,10 @@ mod tests {
});

let total_prevotes_on_nil = consensus_state.get_total_prevotes_on_nil(0);
assert_eq!(total_prevotes_on_nil, 1, "total prevotes on nil should be 1");
assert_eq!(
total_prevotes_on_nil, 1,
"total prevotes on nil should be 1"
);

consensus_state.prevotes.insert(Vote {
proposal: None,
Expand All @@ -262,7 +277,10 @@ mod tests {
});

let total_prevotes_on_nil = consensus_state.get_total_prevotes_on_nil(0);
assert_eq!(total_prevotes_on_nil, 2, "total prevotes on nil should be 2");
assert_eq!(
total_prevotes_on_nil, 2,
"total prevotes on nil should be 2"
);
}

#[test]
Expand All @@ -276,7 +294,10 @@ mod tests {
});

let total_precommits_on_nil = consensus_state.get_total_precommits_on_nil(0);
assert_eq!(total_precommits_on_nil, 1, "total precommits on nil should be 1");
assert_eq!(
total_precommits_on_nil, 1,
"total precommits on nil should be 1"
);

consensus_state.precommits.insert(Vote {
proposal: None,
Expand All @@ -285,6 +306,9 @@ mod tests {
});

let total_precommits_on_nil = consensus_state.get_total_precommits_on_nil(0);
assert_eq!(total_precommits_on_nil, 2, "total precommits on nil should be 2");
assert_eq!(
total_precommits_on_nil, 2,
"total precommits on nil should be 2"
);
}
}

0 comments on commit fd3b1e4

Please sign in to comment.