Rollup merge of #129640 - saethlin:unignore-android-in-alloc, r=tgross35 · patricklam/verify-rust-std@d9af971

Original file line numberDiff line numberDiff line change

@@ -1,7 +1,4 @@

1-

//! This tests the `Integer::{ilog,log2,log10}` methods. These tests are in a

2-

//! separate file because there's both a large number of them, and not all tests

3-

//! can be run on Android. This is because in Android `ilog2` uses an imprecise

4-

//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/unix/android.rs#L27-L53

1+

//! Tests for the `Integer::{ilog,log2,log10}` methods.

52
63

#[test]

74

fn checked_ilog() {

@@ -48,6 +45,10 @@ fn checked_ilog2() {

4845

assert_eq!(0i8.checked_ilog2(), None);

4946

assert_eq!(0i16.checked_ilog2(), None);

5047
48+

assert_eq!(8192u16.checked_ilog2(), Some((8192f32).log2() as u32));

49+

assert_eq!(32768u16.checked_ilog2(), Some((32768f32).log2() as u32));

50+

assert_eq!(8192i16.checked_ilog2(), Some((8192f32).log2() as u32));

51+
5152

for i in 1..=u8::MAX {

5253

assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32), "checking {i}");

5354

}

@@ -77,15 +78,6 @@ fn checked_ilog2() {

7778

}

7879

}

7980
80-

// Validate cases that fail on Android's imprecise float ilog2 implementation.

81-

#[test]

82-

#[cfg(not(target_os = "android"))]

83-

fn checked_ilog2_not_android() {

84-

assert_eq!(8192u16.checked_ilog2(), Some((8192f32).log2() as u32));

85-

assert_eq!(32768u16.checked_ilog2(), Some((32768f32).log2() as u32));

86-

assert_eq!(8192i16.checked_ilog2(), Some((8192f32).log2() as u32));

87-

}

88-
8981

#[test]

9082

fn checked_ilog10() {

9183

assert_eq!(0u8.checked_ilog10(), None);