From fdf99c7c38c1ee48554eaea66b701f470544d037 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 7 May 2024 16:51:35 -0700 Subject: [PATCH] Combine number PartialEq tests --- build.rs | 1 - tests/test.rs | 32 ++++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/build.rs b/build.rs index 433ce12c1..f2124b43f 100644 --- a/build.rs +++ b/build.rs @@ -3,7 +3,6 @@ use std::env; fn main() { println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rustc-check-cfg=cfg(integer128)"); println!("cargo:rustc-check-cfg=cfg(limb_width_32)"); println!("cargo:rustc-check-cfg=cfg(limb_width_64)"); diff --git a/tests/test.rs b/tests/test.rs index 7e6adad76..16840660e 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2100,20 +2100,20 @@ fn issue_220() { assert_eq!(from_str::(r#"{"V": 0}"#).unwrap(), E::V(0)); } -macro_rules! number_partialeq_ok { - ($($n:expr)*) => { - $( - let value = to_value($n).unwrap(); - let s = $n.to_string(); - assert_eq!(value, $n); - assert_eq!($n, value); - assert_ne!(value, s); - )* - } -} - #[test] fn test_partialeq_number() { + macro_rules! number_partialeq_ok { + ($($n:expr)*) => { + $( + let value = to_value($n).unwrap(); + let s = $n.to_string(); + assert_eq!(value, $n); + assert_eq!($n, value); + assert_ne!(value, s); + )* + }; + } + number_partialeq_ok!(0 1 100 i8::MIN i8::MAX i16::MIN i16::MAX i32::MIN i32::MAX i64::MIN i64::MAX u8::MIN u8::MAX u16::MIN u16::MAX u32::MIN u32::MAX u64::MIN u64::MAX @@ -2122,13 +2122,9 @@ fn test_partialeq_number() { f32::consts::E f32::consts::PI f32::consts::LN_2 f32::consts::LOG2_E f64::consts::E f64::consts::PI f64::consts::LN_2 f64::consts::LOG2_E ); -} -#[test] -#[cfg(integer128)] -#[cfg(feature = "arbitrary_precision")] -fn test_partialeq_integer128() { - number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX) + #[cfg(feature = "arbitrary_precision")] + number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX); } #[test]