Add some tests.
This commit is contained in:
parent
e114cfb391
commit
982228f408
|
@ -305,11 +305,6 @@ macro_rules! impl_mul_from {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! impl_if {
|
||||
( $t:tt ) => ( $t )
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
|
|
|
@ -22,9 +22,19 @@ construct_uint! {
|
|||
pub struct U512(8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn u128_conversions() {
|
||||
let mut a = U256::from(u128::max_value());
|
||||
assert_eq!(a.low_u128(), u128::max_value());
|
||||
a += 2u128.into();
|
||||
assert_eq!(a.low_u128(), 1u128);
|
||||
a -= 3u128.into();
|
||||
assert_eq!(a.low_u128(), u128::max_value() - 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uint256_checked_ops() {
|
||||
let z = U256::from(0u128);
|
||||
let z = U256::from(0);
|
||||
let a = U256::from(10);
|
||||
let b = !U256::from(1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue