diff options
| author | Roger Curley <rocurley@gmail.com> | 2025-07-10 10:40:10 -0400 |
|---|---|---|
| committer | Roger Curley <rocurley@gmail.com> | 2025-07-11 10:31:26 -0400 |
| commit | 868020e0594969356d1c41831c84fe68f7b514f0 (patch) | |
| tree | 7728123652af675da02c634bccc815ec4c10f721 | |
| parent | fc01eed02444e412761ac1b5b723d45f443800fb (diff) | |
| download | rust-868020e0594969356d1c41831c84fe68f7b514f0.tar.gz rust-868020e0594969356d1c41831c84fe68f7b514f0.zip | |
Consolidate one tests
| -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 | 19 |
5 files changed, 19 insertions, 52 deletions
diff --git a/library/coretests/tests/floats/f128.rs b/library/coretests/tests/floats/f128.rs index dbf4d6df636..289752673fe 100644 --- a/library/coretests/tests/floats/f128.rs +++ b/library/coretests/tests/floats/f128.rs @@ -41,19 +41,6 @@ const NAN_MASK2: u128 = 0x00005555555555555555555555555555; // the intrinsics. #[test] -fn test_one() { - let one: f128 = 1.0f128; - assert_biteq!(1.0, one); - assert!(!one.is_infinite()); - assert!(one.is_finite()); - assert!(one.is_sign_positive()); - assert!(!one.is_sign_negative()); - assert!(!one.is_nan()); - assert!(one.is_normal()); - assert_eq!(Fp::Normal, one.classify()); -} - -#[test] fn test_is_nan() { let nan: f128 = f128::NAN; let inf: f128 = f128::INFINITY; diff --git a/library/coretests/tests/floats/f16.rs b/library/coretests/tests/floats/f16.rs index 15ab57f8e7e..3435630a4ff 100644 --- a/library/coretests/tests/floats/f16.rs +++ b/library/coretests/tests/floats/f16.rs @@ -47,19 +47,6 @@ const NAN_MASK2: u16 = 0x0155; // the intrinsics. #[test] -fn test_one() { - let one: f16 = 1.0f16; - assert_biteq!(1.0, one); - assert!(!one.is_infinite()); - assert!(one.is_finite()); - assert!(one.is_sign_positive()); - assert!(!one.is_sign_negative()); - assert!(!one.is_nan()); - assert!(one.is_normal()); - assert_eq!(Fp::Normal, one.classify()); -} - -#[test] fn test_is_nan() { let nan: f16 = f16::NAN; let inf: f16 = f16::INFINITY; diff --git a/library/coretests/tests/floats/f32.rs b/library/coretests/tests/floats/f32.rs index 935bfa8b273..5b1151aca9f 100644 --- a/library/coretests/tests/floats/f32.rs +++ b/library/coretests/tests/floats/f32.rs @@ -31,19 +31,6 @@ const NAN_MASK2: u32 = 0x0055_5555; const APPROX_DELTA: f32 = if cfg!(miri) { 1e-4 } else { 1e-6 }; #[test] -fn test_one() { - let one: f32 = 1.0f32; - assert_biteq!(1.0, one); - assert!(!one.is_infinite()); - assert!(one.is_finite()); - assert!(one.is_sign_positive()); - assert!(!one.is_sign_negative()); - assert!(!one.is_nan()); - assert!(one.is_normal()); - assert_eq!(Fp::Normal, one.classify()); -} - -#[test] fn test_is_nan() { let nan: f32 = f32::NAN; let inf: f32 = f32::INFINITY; diff --git a/library/coretests/tests/floats/f64.rs b/library/coretests/tests/floats/f64.rs index d3637dfd9d6..7473fc07dbe 100644 --- a/library/coretests/tests/floats/f64.rs +++ b/library/coretests/tests/floats/f64.rs @@ -26,19 +26,6 @@ const NAN_MASK1: u64 = 0x000a_aaaa_aaaa_aaaa; const NAN_MASK2: u64 = 0x0005_5555_5555_5555; #[test] -fn test_one() { - let one: f64 = 1.0f64; - assert_biteq!(1.0, one); - assert!(!one.is_infinite()); - assert!(one.is_finite()); - assert!(one.is_sign_positive()); - assert!(!one.is_sign_negative()); - assert!(!one.is_nan()); - assert!(one.is_normal()); - assert_eq!(Fp::Normal, one.classify()); -} - -#[test] fn test_is_nan() { let nan: f64 = f64::NAN; let inf: f64 = f64::INFINITY; diff --git a/library/coretests/tests/floats/mod.rs b/library/coretests/tests/floats/mod.rs index 006f51488dd..abe827b6988 100644 --- a/library/coretests/tests/floats/mod.rs +++ b/library/coretests/tests/floats/mod.rs @@ -362,6 +362,25 @@ float_test! { } float_test! { + name: one, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test<Float> { + let one: Float = 1.0; + assert_biteq!(1.0, one); + assert!(!one.is_infinite()); + assert!(one.is_finite()); + assert!(one.is_sign_positive()); + assert!(!one.is_sign_negative()); + assert!(!one.is_nan()); + assert!(one.is_normal()); + assert!(matches!(one.classify(), Fp::Normal)); + } +} + +float_test! { name: min, attrs: { f16: #[cfg(any(miri, target_has_reliable_f16_math))], |
