test constant LOG2_10 and LOG10_2

Before this commit, the tests were skipped because the corresponding
standard library constants were unstable, but the values themselves
could easily be computed for the test. Once the minimum rustc
supported becomes 1.43.0, the tests should be changed to use the
constants instead of the computation.
This commit is contained in:
Trevor Spiteri 2020-04-08 13:23:04 +02:00
parent b035ae9dbe
commit b41c726da5
1 changed files with 8 additions and 4 deletions

View File

@ -258,9 +258,11 @@ mod tests {
assert_eq!(f32::from_fixed(SQRT_2), f32::consts::SQRT_2);
assert_eq!(f32::from_fixed(FRAC_1_SQRT_2), f32::consts::FRAC_1_SQRT_2);
assert_eq!(f32::from_fixed(E), f32::consts::E);
// assert_eq!(f32::from_fixed(LOG2_10), f32::consts::LOG2_10);
// TODO when rustc requirement >= 1.43.0, use f32::consts::LOG2_10
assert_eq!(f32::from_fixed(LOG2_10), 10f32.log2());
assert_eq!(f32::from_fixed(LOG2_E), f32::consts::LOG2_E);
// assert_eq!(f32::from_fixed(LOG10_2), f32::consts::LOG10_2);
// TODO when rustc requirement >= 1.43.0, use f32::consts::LOG10_2
assert_eq!(f32::from_fixed(LOG10_2), 2f32.log10());
assert_eq!(f32::from_fixed(LOG10_E), f32::consts::LOG10_E);
assert_eq!(f32::from_fixed(LN_2), f32::consts::LN_2);
assert_eq!(f32::from_fixed(LN_10), f32::consts::LN_10);
@ -290,9 +292,11 @@ mod tests {
assert_eq!(f64::from_fixed(SQRT_2), f64::consts::SQRT_2);
assert_eq!(f64::from_fixed(FRAC_1_SQRT_2), f64::consts::FRAC_1_SQRT_2);
assert_eq!(f64::from_fixed(E), f64::consts::E);
// assert_eq!(f64::from_fixed(LOG2_10), f64::consts::LOG2_10);
// TODO when rustc requirement >= 1.43.0, use f64::consts::LOG2_10
assert_eq!(f64::from_fixed(LOG2_10), 10f64.log2());
assert_eq!(f64::from_fixed(LOG2_E), f64::consts::LOG2_E);
// assert_eq!(f64::from_fixed(LOG10_2), f64::consts::LOG10_2);
// TODO when rustc requirement >= 1.43.0, use f64::consts::LOG10_2
assert_eq!(f64::from_fixed(LOG10_2), 2f64.log10());
assert_eq!(f64::from_fixed(LOG10_E), f64::consts::LOG10_E);
assert_eq!(f64::from_fixed(LN_2), f64::consts::LN_2);
assert_eq!(f64::from_fixed(LN_10), f64::consts::LN_10);