Consolidate sqrt_domain tests
This commit is contained in:
parent
8a65ce4360
commit
666bfcae21
5 changed files with 23 additions and 48 deletions
|
|
@ -78,19 +78,6 @@ fn test_powi() {
|
|||
assert_biteq!(neg_inf.powi(2), inf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
#[cfg(target_has_reliable_f128_math)]
|
||||
fn test_sqrt_domain() {
|
||||
assert!(f128::NAN.sqrt().is_nan());
|
||||
assert!(f128::NEG_INFINITY.sqrt().is_nan());
|
||||
assert!((-1.0f128).sqrt().is_nan());
|
||||
assert_biteq!((-0.0f128).sqrt(), -0.0);
|
||||
assert_biteq!(0.0f128.sqrt(), 0.0);
|
||||
assert_biteq!(1.0f128.sqrt(), 1.0);
|
||||
assert_biteq!(f128::INFINITY.sqrt(), f128::INFINITY);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_degrees() {
|
||||
let pi: f128 = consts::PI;
|
||||
|
|
|
|||
|
|
@ -80,19 +80,6 @@ fn test_powi() {
|
|||
assert_biteq!(neg_inf.powi(2), inf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
#[cfg(target_has_reliable_f16_math)]
|
||||
fn test_sqrt_domain() {
|
||||
assert!(f16::NAN.sqrt().is_nan());
|
||||
assert!(f16::NEG_INFINITY.sqrt().is_nan());
|
||||
assert!((-1.0f16).sqrt().is_nan());
|
||||
assert_biteq!((-0.0f16).sqrt(), -0.0);
|
||||
assert_biteq!(0.0f16.sqrt(), 0.0);
|
||||
assert_biteq!(1.0f16.sqrt(), 1.0);
|
||||
assert_biteq!(f16::INFINITY.sqrt(), f16::INFINITY);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_degrees() {
|
||||
let pi: f16 = consts::PI;
|
||||
|
|
|
|||
|
|
@ -60,17 +60,6 @@ fn test_powi() {
|
|||
assert_biteq!(neg_inf.powi(2), inf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sqrt_domain() {
|
||||
assert!(f32::NAN.sqrt().is_nan());
|
||||
assert!(f32::NEG_INFINITY.sqrt().is_nan());
|
||||
assert!((-1.0f32).sqrt().is_nan());
|
||||
assert_biteq!((-0.0f32).sqrt(), -0.0);
|
||||
assert_biteq!(0.0f32.sqrt(), 0.0);
|
||||
assert_biteq!(1.0f32.sqrt(), 1.0);
|
||||
assert_biteq!(f32::INFINITY.sqrt(), f32::INFINITY);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_degrees() {
|
||||
let pi: f32 = consts::PI;
|
||||
|
|
|
|||
|
|
@ -55,17 +55,6 @@ fn test_powi() {
|
|||
assert_biteq!(neg_inf.powi(2), inf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sqrt_domain() {
|
||||
assert!(f64::NAN.sqrt().is_nan());
|
||||
assert!(f64::NEG_INFINITY.sqrt().is_nan());
|
||||
assert!((-1.0f64).sqrt().is_nan());
|
||||
assert_biteq!((-0.0f64).sqrt(), -0.0);
|
||||
assert_biteq!(0.0f64.sqrt(), 0.0);
|
||||
assert_biteq!(1.0f64.sqrt(), 1.0);
|
||||
assert_biteq!(f64::INFINITY.sqrt(), f64::INFINITY);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_degrees() {
|
||||
let pi: f64 = consts::PI;
|
||||
|
|
|
|||
|
|
@ -1122,3 +1122,26 @@ float_test! {
|
|||
assert_biteq!(nan2.next_down(), nan2);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support
|
||||
// the intrinsics.
|
||||
|
||||
float_test! {
|
||||
name: sqrt_domain,
|
||||
attrs: {
|
||||
const: #[cfg(false)],
|
||||
f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
|
||||
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
|
||||
},
|
||||
test<Float> {
|
||||
let one: Float = 1.0;
|
||||
let zero: Float = 0.0;
|
||||
assert!(Float::NAN.sqrt().is_nan());
|
||||
assert!(Float::NEG_INFINITY.sqrt().is_nan());
|
||||
assert!((-one).sqrt().is_nan());
|
||||
assert_biteq!((-zero).sqrt(), -zero);
|
||||
assert_biteq!(zero.sqrt(), zero);
|
||||
assert_biteq!(one.sqrt(), one);
|
||||
assert_biteq!(Float::INFINITY.sqrt(), Float::INFINITY);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue