Added a custom epsilon for tests.
This commit is contained in:
@@ -301,6 +301,8 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
const EPSILON: f64 = 2e-14;
|
||||||
|
|
||||||
impl AbsDiffEq for Rating {
|
impl AbsDiffEq for Rating {
|
||||||
type Epsilon = f64;
|
type Epsilon = f64;
|
||||||
|
|
||||||
@@ -336,7 +338,7 @@ mod tests {
|
|||||||
let alice = Rating::new(MU, SIGMA);
|
let alice = Rating::new(MU, SIGMA);
|
||||||
let bob = Rating::new(MU, SIGMA);
|
let bob = Rating::new(MU, SIGMA);
|
||||||
|
|
||||||
assert_relative_eq!(quality(&[&[alice], &[bob]]), 0.4472135954999579);
|
assert_relative_eq!(quality(&[&[alice], &[bob]]), 0.4472135954999579, epsilon = EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -356,7 +358,7 @@ mod tests {
|
|||||||
let ratings = rate(&[&[alice], &[bob], &[chris], &[darren]]);
|
let ratings = rate(&[&[alice], &[bob], &[chris], &[darren]]);
|
||||||
|
|
||||||
for (rating, expected) in ratings.iter().zip(expected_ratings.iter()) {
|
for (rating, expected) in ratings.iter().zip(expected_ratings.iter()) {
|
||||||
assert_relative_eq!(rating, expected);
|
assert_relative_eq!(rating, expected, epsilon = EPSILON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user