Skip to content

Commit fdf99c7

Browse files
committed
Combine number PartialEq tests
1 parent b4fc245 commit fdf99c7

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

Diff for: build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::env;
33
fn main() {
44
println!("cargo:rerun-if-changed=build.rs");
55

6-
println!("cargo:rustc-check-cfg=cfg(integer128)");
76
println!("cargo:rustc-check-cfg=cfg(limb_width_32)");
87
println!("cargo:rustc-check-cfg=cfg(limb_width_64)");
98

Diff for: tests/test.rs

+14-18
Original file line numberDiff line numberDiff line change
@@ -2100,20 +2100,20 @@ fn issue_220() {
21002100
assert_eq!(from_str::<E>(r#"{"V": 0}"#).unwrap(), E::V(0));
21012101
}
21022102

2103-
macro_rules! number_partialeq_ok {
2104-
($($n:expr)*) => {
2105-
$(
2106-
let value = to_value($n).unwrap();
2107-
let s = $n.to_string();
2108-
assert_eq!(value, $n);
2109-
assert_eq!($n, value);
2110-
assert_ne!(value, s);
2111-
)*
2112-
}
2113-
}
2114-
21152103
#[test]
21162104
fn test_partialeq_number() {
2105+
macro_rules! number_partialeq_ok {
2106+
($($n:expr)*) => {
2107+
$(
2108+
let value = to_value($n).unwrap();
2109+
let s = $n.to_string();
2110+
assert_eq!(value, $n);
2111+
assert_eq!($n, value);
2112+
assert_ne!(value, s);
2113+
)*
2114+
};
2115+
}
2116+
21172117
number_partialeq_ok!(0 1 100
21182118
i8::MIN i8::MAX i16::MIN i16::MAX i32::MIN i32::MAX i64::MIN i64::MAX
21192119
u8::MIN u8::MAX u16::MIN u16::MAX u32::MIN u32::MAX u64::MIN u64::MAX
@@ -2122,13 +2122,9 @@ fn test_partialeq_number() {
21222122
f32::consts::E f32::consts::PI f32::consts::LN_2 f32::consts::LOG2_E
21232123
f64::consts::E f64::consts::PI f64::consts::LN_2 f64::consts::LOG2_E
21242124
);
2125-
}
21262125

2127-
#[test]
2128-
#[cfg(integer128)]
2129-
#[cfg(feature = "arbitrary_precision")]
2130-
fn test_partialeq_integer128() {
2131-
number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX)
2126+
#[cfg(feature = "arbitrary_precision")]
2127+
number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX);
21322128
}
21332129

21342130
#[test]

0 commit comments

Comments
 (0)