diff options
| -rw-r--r-- | library/coretests/tests/floats/f128.rs | 13 | ||||
| -rw-r--r-- | library/coretests/tests/floats/f16.rs | 13 | ||||
| -rw-r--r-- | library/coretests/tests/floats/f32.rs | 13 | ||||
| -rw-r--r-- | library/coretests/tests/floats/f64.rs | 13 | ||||
| -rw-r--r-- | library/coretests/tests/floats/mod.rs | 21 |
5 files changed, 21 insertions, 52 deletions
diff --git a/library/coretests/tests/floats/f128.rs b/library/coretests/tests/floats/f128.rs index d67cae19bb7..d3f8e8ef1d2 100644 --- a/library/coretests/tests/floats/f128.rs +++ b/library/coretests/tests/floats/f128.rs @@ -40,19 +40,6 @@ const NAN_MASK2: u128 = 0x00005555555555555555555555555555; // the intrinsics. #[test] -fn test_is_sign_negative() { - assert!(!f128::INFINITY.is_sign_negative()); - assert!(!1f128.is_sign_negative()); - assert!(!0f128.is_sign_negative()); - assert!((-0f128).is_sign_negative()); - assert!((-1f128).is_sign_negative()); - assert!(f128::NEG_INFINITY.is_sign_negative()); - assert!((1f128 / f128::NEG_INFINITY).is_sign_negative()); - assert!(!f128::NAN.is_sign_negative()); - assert!((-f128::NAN).is_sign_negative()); -} - -#[test] fn test_next_up() { let tiny = f128::from_bits(TINY_BITS); let tiny_up = f128::from_bits(TINY_UP_BITS); diff --git a/library/coretests/tests/floats/f16.rs b/library/coretests/tests/floats/f16.rs index 9ec43f012a2..db46bff1571 100644 --- a/library/coretests/tests/floats/f16.rs +++ b/library/coretests/tests/floats/f16.rs @@ -46,19 +46,6 @@ const NAN_MASK2: u16 = 0x0155; // the intrinsics. #[test] -fn test_is_sign_negative() { - assert!(!f16::INFINITY.is_sign_negative()); - assert!(!1f16.is_sign_negative()); - assert!(!0f16.is_sign_negative()); - assert!((-0f16).is_sign_negative()); - assert!((-1f16).is_sign_negative()); - assert!(f16::NEG_INFINITY.is_sign_negative()); - assert!((1f16 / f16::NEG_INFINITY).is_sign_negative()); - assert!(!f16::NAN.is_sign_negative()); - assert!((-f16::NAN).is_sign_negative()); -} - -#[test] fn test_next_up() { let tiny = f16::from_bits(TINY_BITS); let tiny_up = f16::from_bits(TINY_UP_BITS); diff --git a/library/coretests/tests/floats/f32.rs b/library/coretests/tests/floats/f32.rs index c4597438250..6994e813408 100644 --- a/library/coretests/tests/floats/f32.rs +++ b/library/coretests/tests/floats/f32.rs @@ -30,19 +30,6 @@ const NAN_MASK2: u32 = 0x0055_5555; const APPROX_DELTA: f32 = if cfg!(miri) { 1e-4 } else { 1e-6 }; #[test] -fn test_is_sign_negative() { - assert!(!f32::INFINITY.is_sign_negative()); - assert!(!1f32.is_sign_negative()); - assert!(!0f32.is_sign_negative()); - assert!((-0f32).is_sign_negative()); - assert!((-1f32).is_sign_negative()); - assert!(f32::NEG_INFINITY.is_sign_negative()); - assert!((1f32 / f32::NEG_INFINITY).is_sign_negative()); - assert!(!f32::NAN.is_sign_negative()); - assert!((-f32::NAN).is_sign_negative()); -} - -#[test] fn test_next_up() { let tiny = f32::from_bits(TINY_BITS); let tiny_up = f32::from_bits(TINY_UP_BITS); diff --git a/library/coretests/tests/floats/f64.rs b/library/coretests/tests/floats/f64.rs index d20f45d872d..6b5fc8f69c3 100644 --- a/library/coretests/tests/floats/f64.rs +++ b/library/coretests/tests/floats/f64.rs @@ -25,19 +25,6 @@ const NAN_MASK1: u64 = 0x000a_aaaa_aaaa_aaaa; const NAN_MASK2: u64 = 0x0005_5555_5555_5555; #[test] -fn test_is_sign_negative() { - assert!(!f64::INFINITY.is_sign_negative()); - assert!(!1f64.is_sign_negative()); - assert!(!0f64.is_sign_negative()); - assert!((-0f64).is_sign_negative()); - assert!((-1f64).is_sign_negative()); - assert!(f64::NEG_INFINITY.is_sign_negative()); - assert!((1f64 / f64::NEG_INFINITY).is_sign_negative()); - assert!(!f64::NAN.is_sign_negative()); - assert!((-f64::NAN).is_sign_negative()); -} - -#[test] fn test_next_up() { let tiny = f64::from_bits(TINY_BITS); let tiny_up = f64::from_bits(TINY_UP_BITS); diff --git a/library/coretests/tests/floats/mod.rs b/library/coretests/tests/floats/mod.rs index d45cc73174a..b8600b30fd7 100644 --- a/library/coretests/tests/floats/mod.rs +++ b/library/coretests/tests/floats/mod.rs @@ -998,3 +998,24 @@ float_test! { assert!(!(-Float::NAN).is_sign_positive()); } } + +float_test! { + name: is_sign_negative, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test<Float> { + let one: Float = 1.0; + let zero: Float = 0.0; + assert!(!Float::INFINITY.is_sign_negative()); + assert!(!one.is_sign_negative()); + assert!(!zero.is_sign_negative()); + assert!((-zero).is_sign_negative()); + assert!((-one).is_sign_negative()); + assert!(Float::NEG_INFINITY.is_sign_negative()); + assert!((one / Float::NEG_INFINITY).is_sign_negative()); + assert!(!Float::NAN.is_sign_negative()); + assert!((-Float::NAN).is_sign_negative()); + } +} |
