Added another test.
This commit is contained in:
24
src/lib.rs
24
src/lib.rs
@@ -395,6 +395,30 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_rate_8_free_for_all() {
|
||||||
|
// Example from http://research.microsoft.com/en-us/projects/trueskill/details.aspx
|
||||||
|
|
||||||
|
let (ratings, ranks) = generate_free_for_all(8);
|
||||||
|
|
||||||
|
let expected_ratings = vec![
|
||||||
|
Rating::new(36.77209218345724, 5.74919889706158),
|
||||||
|
Rating::new(32.24259218000257, 5.13287020009844),
|
||||||
|
Rating::new(29.07403314155725, 4.94269079502333),
|
||||||
|
Rating::new(26.32218621002892, 4.87453695296329),
|
||||||
|
Rating::new(23.67782451664047, 4.87454338643793),
|
||||||
|
Rating::new(20.92602299394360, 4.94271209665760),
|
||||||
|
Rating::new(17.75766311093125, 5.13291097072849),
|
||||||
|
Rating::new(13.22891063797913, 5.74928289201801),
|
||||||
|
];
|
||||||
|
|
||||||
|
let ratings = rate(ratings.as_ref(), ranks.as_ref(), DELTA);
|
||||||
|
|
||||||
|
for (rating, expected) in ratings.iter().zip(expected_ratings.iter()) {
|
||||||
|
assert_relative_eq!(rating, expected, epsilon = EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rate_8_free_for_all_draw() {
|
fn test_rate_8_free_for_all_draw() {
|
||||||
let (ratings, ranks) = generate_free_for_all_draw(8);
|
let (ratings, ranks) = generate_free_for_all_draw(8);
|
||||||
|
|||||||
Reference in New Issue
Block a user