From b41c726da58e5e774d740ce47fb05036efcd6033 Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Wed, 8 Apr 2020 13:23:04 +0200 Subject: [PATCH] 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. --- src/consts.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/consts.rs b/src/consts.rs index 1da82c3..5947fe1 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -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);