aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/num.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ctr-std/src/num.rs')
-rw-r--r--ctr-std/src/num.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/ctr-std/src/num.rs b/ctr-std/src/num.rs
index b7618ac..a2c1339 100644
--- a/ctr-std/src/num.rs
+++ b/ctr-std/src/num.rs
@@ -18,7 +18,6 @@
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError};
-
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::num::Wrapping;
@@ -170,10 +169,14 @@ mod tests {
macro_rules! test_checked_next_power_of_two {
($test_name:ident, $T:ident) => (
+ #[cfg_attr(target_os = "emscripten", ignore)] // FIXME(#39119)
fn $test_name() {
#![test]
assert_eq!((0 as $T).checked_next_power_of_two(), Some(1));
- assert!(($T::MAX / 2).checked_next_power_of_two().is_some());
+ let smax = $T::MAX >> 1;
+ assert_eq!(smax.checked_next_power_of_two(), Some(smax+1));
+ assert_eq!((smax + 1).checked_next_power_of_two(), Some(smax + 1));
+ assert_eq!((smax + 2).checked_next_power_of_two(), None);
assert_eq!(($T::MAX - 1).checked_next_power_of_two(), None);
assert_eq!($T::MAX.checked_next_power_of_two(), None);
let mut next_power = 1;