Skip to content

Commit

Permalink
Enable some ilog2 tests as well
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Aug 27, 2024
1 parent b2baccc commit 0ccf276
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions library/core/tests/num/int_log.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//! This tests the `Integer::{ilog,log2,log10}` methods. These tests are in a
//! separate file because there's both a large number of them, and not all tests
//! can be run on Android. This is because in Android `ilog2` uses an imprecise
//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/unix/android.rs#L27-L53
//! Tests for the `Integer::{ilog,log2,log10}` methods.

#[test]
fn checked_ilog() {
Expand Down Expand Up @@ -77,10 +74,8 @@ fn checked_ilog2() {
}
}

// Validate cases that fail on Android's imprecise float ilog2 implementation.
#[test]
#[cfg(not(target_os = "android"))]
fn checked_ilog2_not_android() {
fn checked_ilog2() {
assert_eq!(8192u16.checked_ilog2(), Some((8192f32).log2() as u32));
assert_eq!(32768u16.checked_ilog2(), Some((32768f32).log2() as u32));
assert_eq!(8192i16.checked_ilog2(), Some((8192f32).log2() as u32));
Expand Down

0 comments on commit 0ccf276

Please sign in to comment.