Add some tests.

This commit is contained in:
Tomasz Drwięga 2019-01-11 14:25:28 +01:00 committed by Tomasz Drwięga
parent e114cfb391
commit 982228f408
No known key found for this signature in database
GPG Key ID: 32E366A18EED312D
2 changed files with 11 additions and 6 deletions

View File

@ -305,11 +305,6 @@ macro_rules! impl_mul_from {
}
}
}
#[macro_export]
#[doc(hidden)]
macro_rules! impl_if {
( $t:tt ) => ( $t )
}
#[macro_export]
#[doc(hidden)]

View File

@ -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);