From dafbe58893821e6a46bbca1c078256fa61b5c9c1 Mon Sep 17 00:00:00 2001 From: atomflunder <80397293+atomflunder@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:51:57 +0200 Subject: [PATCH] Add test for trait --- src/trueskill/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/trueskill/mod.rs b/src/trueskill/mod.rs index 39b8e90..f63f22a 100644 --- a/src/trueskill/mod.rs +++ b/src/trueskill/mod.rs @@ -2549,6 +2549,18 @@ mod tests { TeamRatingSystem::expected_score(&rating_system, &[player_one], &[player_two]); assert!((exp1 + exp2 - 1.0).abs() < f64::EPSILON); + + let multi_team_rating: TrueSkill = MultiTeamRatingSystem::new(TrueSkillConfig::new()); + let mtr = MultiTeamRatingSystem::rate( + &multi_team_rating, + &[ + (&[player_one], MultiTeamOutcome::new(1)), + (&[player_two], MultiTeamOutcome::new(2)), + ], + ); + + assert!((mtr[0][0].rating - 24.534_091_256_161_39).abs() < f64::EPSILON); + assert!((mtr[1][0].rating - 23.465_908_743_838_607).abs() < f64::EPSILON); } #[test]