Skip to content

Commit

Permalink
Unrolled build for rust-lang#126613
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#126613 - tgross35:log-test-update, r=cuviper

Print the tested value in int_log tests

Tiny change - from the failures in rust-lang#125016, it would have been nice to see what the tested values were. Update the assertion messages.
  • Loading branch information
rust-timer authored Jun 21, 2024
2 parents e32ea48 + c4ddc86 commit 23b0f7d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions library/core/tests/num/int_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ fn checked_ilog() {

#[cfg(not(miri))] // Miri is too slow
for i in i16::MIN..=0 {
assert_eq!(i.checked_ilog(4), None);
assert_eq!(i.checked_ilog(4), None, "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=i16::MAX {
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32));
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32), "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=u16::MAX {
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32));
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32), "checking {i}");
}
}

Expand All @@ -49,30 +49,30 @@ fn checked_ilog2() {
assert_eq!(0i16.checked_ilog2(), None);

for i in 1..=u8::MAX {
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32));
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32), "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=u16::MAX {
// Guard against Android's imprecise f32::ilog2 implementation.
if i != 8192 && i != 32768 {
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32));
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32), "checking {i}");
}
}
for i in i8::MIN..=0 {
assert_eq!(i.checked_ilog2(), None);
assert_eq!(i.checked_ilog2(), None, "checking {i}");
}
for i in 1..=i8::MAX {
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32));
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32), "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in i16::MIN..=0 {
assert_eq!(i.checked_ilog2(), None);
assert_eq!(i.checked_ilog2(), None, "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=i16::MAX {
// Guard against Android's imprecise f32::ilog2 implementation.
if i != 8192 {
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32));
assert_eq!(i.checked_ilog2(), Some((i as f32).log2() as u32), "checking {i}");
}
}
}
Expand All @@ -95,19 +95,19 @@ fn checked_ilog10() {

#[cfg(not(miri))] // Miri is too slow
for i in i16::MIN..=0 {
assert_eq!(i.checked_ilog10(), None);
assert_eq!(i.checked_ilog10(), None, "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=i16::MAX {
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32));
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32), "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=u16::MAX {
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32));
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32), "checking {i}");
}
#[cfg(not(miri))] // Miri is too slow
for i in 1..=100_000u32 {
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32));
assert_eq!(i.checked_ilog10(), Some((i as f32).log10() as u32), "checking {i}");
}
}

Expand Down

0 comments on commit 23b0f7d

Please sign in to comment.