Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

AlexD10S
Copy link
Contributor

I changed the name of the test check_elo_player_aborts with check_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.

src/tests.rs Outdated
@@ -534,7 +534,51 @@ fn check_elo_stronger_looses() {
}

#[test]
fn check_elo_player_aborts() {
fn check_elo_player_draw() {
Copy link
Collaborator

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);
Copy link
Collaborator

@Moliholy Moliholy Aug 31, 2023

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.

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: abandoned.

@AlexD10S AlexD10S requested a review from Moliholy September 1, 2023 10:15
@Moliholy
Copy link
Collaborator

Moliholy commented Sep 1, 2023

Looks good to me. I however can't trigger the merge when the CI passes 😞

@bernardoaraujor
Copy link
Contributor

@Moliholy just added you as a contributor to the repo, let me know if you got the invite.

Feel free to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants