mirror of
https://gitlab.com/artofrev/smallint.git
synced 2024-12-04 17:11:38 -05:00
improve test coverage
This commit is contained in:
parent
81739a1311
commit
234fce4b92
|
@ -11,8 +11,8 @@ impl PartialEq for SmallUint {
|
|||
Ordering::Greater => false,
|
||||
Ordering::Less => false,
|
||||
Ordering::Equal => {
|
||||
let slice1 = unsafe { core::slice::from_raw_parts(r, *s) };
|
||||
let slice2 = unsafe { core::slice::from_raw_parts(i, *j) };
|
||||
let slice1 = unsafe { core::slice::from_raw_parts(*r, *s) };
|
||||
let slice2 = unsafe { core::slice::from_raw_parts(*i, *j) };
|
||||
for i in 0..*s {
|
||||
match slice1[s - 1 - i].cmp(&slice2[s - 1 - i]) {
|
||||
Ordering::Less => return false,
|
||||
|
@ -71,8 +71,8 @@ impl PartialEq for SmallInt {
|
|||
Ordering::Equal => {
|
||||
let us = s.unsigned_abs();
|
||||
let uj = j.unsigned_abs();
|
||||
let slice1 = unsafe { core::slice::from_raw_parts(r, us) };
|
||||
let slice2 = unsafe { core::slice::from_raw_parts(i, uj) };
|
||||
let slice1 = unsafe { core::slice::from_raw_parts(*r, us) };
|
||||
let slice2 = unsafe { core::slice::from_raw_parts(*i, uj) };
|
||||
for i in 0..*s {
|
||||
match slice1[(s - 1 - i) as usize].cmp(&slice2[(s - 1 - i) as usize]) {
|
||||
Ordering::Less => return false,
|
||||
|
|
14
src/tests.rs
14
src/tests.rs
|
@ -119,6 +119,20 @@ fn run_tests_i_2<T: Eq + Debug>(
|
|||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "num-bigint")]
|
||||
fn test_convert_biguint() {
|
||||
run_tests_u_1(|i| BigUint::from(&i), |i| i.clone());
|
||||
run_tests_u_1(|i| i, |i| SmallUint::from(i));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "num-bigint")]
|
||||
fn test_convert_bigint() {
|
||||
run_tests_i_1(|i| BigInt::from(&i), |i| i.clone());
|
||||
run_tests_i_1(|i| i, |i| SmallInt::from(i));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "num-bigint")]
|
||||
fn test_cmp_u() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user