-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend unit testing for elo-ranking #36
base: master
Are you sure you want to change the base?
Conversation
src/tests.rs
Outdated
@@ -534,7 +534,51 @@ fn check_elo_stronger_looses() { | |||
} | |||
|
|||
#[test] | |||
fn check_elo_player_aborts() { | |||
fn check_elo_player_draw() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in English it's "draws", in plural.
src/tests.rs
Outdated
|
||
// check elo before the match finishes | ||
assert_eq!(Chess::player_elo(charlie), 1000); | ||
assert_eq!(Chess::player_elo(dave), 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If both players have the same ELO and make draws then they maintain the same ELO, that's correct. However, in the previous example it checked what happens if they have different ELO, which I think it's interesting to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right, it makes more sense your approach to see is changing. Revert it in this commit 7d2c849
src/tests.rs
Outdated
System::block_number() + <Test as Config>::BulletPeriod::get() + 1, | ||
); | ||
|
||
// Bob abandom, alice claims victory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: abandoned.
Looks good to me. I however can't trigger the merge when the CI passes 😞 |
@Moliholy just added you as a contributor to the repo, let me know if you got the invite. Feel free to merge. |
I changed the name of the test
check_elo_player_aborts
withcheck_elo_player_draw
because what is actually testing is the scenario of a draw (I change the players ELO ranking too, but just for testing purposes).I add a test
check_elo_stronger_abandon
where the stronger player abandon and therefore loses to see if in case of abandom the ELO ranking is updating property too.