2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
2019-02-07 12:12:17 -06:00
|
|
|
|
2019-02-05 14:36:31 -06:00
|
|
|
const INT_U32_NO: u32 = (42 as u32).saturating_add(2);
|
2020-06-02 02:59:11 -05:00
|
|
|
const INT_U32: u32 = u32::MAX.saturating_add(1);
|
|
|
|
const INT_U128: u128 = u128::MAX.saturating_add(1);
|
|
|
|
const INT_I128: i128 = i128::MAX.saturating_add(1);
|
|
|
|
const INT_I128_NEG: i128 = i128::MIN.saturating_add(-1);
|
2019-02-05 14:36:31 -06:00
|
|
|
|
2019-02-06 15:15:17 -06:00
|
|
|
const INT_U32_NO_SUB: u32 = (42 as u32).saturating_sub(2);
|
2019-02-06 17:10:08 -06:00
|
|
|
const INT_U32_SUB: u32 = (1 as u32).saturating_sub(2);
|
2019-02-06 15:15:17 -06:00
|
|
|
const INT_I32_NO_SUB: i32 = (-42 as i32).saturating_sub(2);
|
2020-06-02 02:59:11 -05:00
|
|
|
const INT_I32_NEG_SUB: i32 = i32::MIN.saturating_sub(1);
|
|
|
|
const INT_I32_POS_SUB: i32 = i32::MAX.saturating_sub(-1);
|
2019-02-06 17:10:08 -06:00
|
|
|
const INT_U128_SUB: u128 = (0 as u128).saturating_sub(1);
|
2020-06-02 02:59:11 -05:00
|
|
|
const INT_I128_NEG_SUB: i128 = i128::MIN.saturating_sub(1);
|
|
|
|
const INT_I128_POS_SUB: i128 = i128::MAX.saturating_sub(-1);
|
2019-02-06 15:15:17 -06:00
|
|
|
|
2019-02-05 14:36:31 -06:00
|
|
|
fn main() {
|
|
|
|
assert_eq!(INT_U32_NO, 44);
|
2020-06-02 02:59:11 -05:00
|
|
|
assert_eq!(INT_U32, u32::MAX);
|
|
|
|
assert_eq!(INT_U128, u128::MAX);
|
|
|
|
assert_eq!(INT_I128, i128::MAX);
|
|
|
|
assert_eq!(INT_I128_NEG, i128::MIN);
|
2019-02-06 15:15:17 -06:00
|
|
|
|
|
|
|
assert_eq!(INT_U32_NO_SUB, 40);
|
2019-02-06 17:10:08 -06:00
|
|
|
assert_eq!(INT_U32_SUB, 0);
|
2019-02-06 15:15:17 -06:00
|
|
|
assert_eq!(INT_I32_NO_SUB, -44);
|
2020-06-02 02:59:11 -05:00
|
|
|
assert_eq!(INT_I32_NEG_SUB, i32::MIN);
|
|
|
|
assert_eq!(INT_I32_POS_SUB, i32::MAX);
|
2019-02-06 17:10:08 -06:00
|
|
|
assert_eq!(INT_U128_SUB, 0);
|
2020-06-02 02:59:11 -05:00
|
|
|
assert_eq!(INT_I128_NEG_SUB, i128::MIN);
|
|
|
|
assert_eq!(INT_I128_POS_SUB, i128::MAX);
|
2019-02-06 15:15:17 -06:00
|
|
|
}
|