add #[cfg(feature = "num-bigint")] to some test helper functions

This commit is contained in:
Solomon Ucko 2022-08-14 15:44:16 -04:00
parent 7702b67f07
commit 2e081c03c5

View File

@ -33,6 +33,7 @@ conversion_tests!(i64, test_i64);
conversion_tests!(u128, test_u128);
conversion_tests!(i128, test_i128);
#[cfg(feature = "num-bigint")]
fn run_tests_u_inner(test: impl Fn(BigUint)) {
for i in 0u8..=7 {
test(BigUint::from(i));
@ -52,6 +53,7 @@ fn run_tests_u_inner(test: impl Fn(BigUint)) {
}
#[allow(dead_code)]
#[cfg(feature = "num-bigint")]
fn run_tests_u_1<T: Eq + Debug>(small: impl Fn(SmallUint) -> T, big: impl Fn(&BigUint) -> T) {
run_tests_u_inner(|i| {
let small_result = small(SmallUint::from(&i));
@ -64,6 +66,7 @@ fn run_tests_u_1<T: Eq + Debug>(small: impl Fn(SmallUint) -> T, big: impl Fn(&Bi
});
}
#[cfg(feature = "num-bigint")]
fn run_tests_u_2<T: Eq + Debug>(
small: impl Fn(SmallUint, SmallUint) -> T,
big: impl Fn(&BigUint, &BigUint) -> T
@ -79,6 +82,7 @@ fn run_tests_u_2<T: Eq + Debug>(
}));
}
#[cfg(feature = "num-bigint")]
fn run_tests_i_inner(test: impl Fn(BigInt)) {
run_tests_u_inner(|value| {
test(BigInt::from_biguint(Sign::Plus, value.clone()));
@ -86,6 +90,7 @@ fn run_tests_i_inner(test: impl Fn(BigInt)) {
});
}
#[cfg(feature = "num-bigint")]
fn run_tests_i_1<T: Eq + Debug>(small: impl Fn(SmallInt) -> T, big: impl Fn(&BigInt) -> T) {
run_tests_i_inner(|i| {
let small_result = small(SmallInt::from(&i));
@ -98,6 +103,7 @@ fn run_tests_i_1<T: Eq + Debug>(small: impl Fn(SmallInt) -> T, big: impl Fn(&Big
});
}
#[cfg(feature = "num-bigint")]
fn run_tests_i_2<T: Eq + Debug>(
small: impl Fn(SmallInt, SmallInt) -> T,
big: impl Fn(&BigInt, &BigInt) -> T