2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-08-31 15:02:01 +02:00
|
|
|
#![allow(unused_comparisons)]
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
// Unsigned integer operations
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-03-28 18:39:09 -07:00
|
|
|
assert!((0u8 < 255u8));
|
|
|
|
assert!((0u8 <= 255u8));
|
|
|
|
assert!((255u8 > 0u8));
|
|
|
|
assert!((255u8 >= 0u8));
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(250u8 / 10u8, 25u8);
|
|
|
|
assert_eq!(255u8 % 10u8, 5u8);
|
2013-03-28 18:39:09 -07:00
|
|
|
assert!((0u16 < 60000u16));
|
|
|
|
assert!((0u16 <= 60000u16));
|
|
|
|
assert!((60000u16 > 0u16));
|
|
|
|
assert!((60000u16 >= 0u16));
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(60000u16 / 10u16, 6000u16);
|
|
|
|
assert_eq!(60005u16 % 10u16, 5u16);
|
2013-03-28 18:39:09 -07:00
|
|
|
assert!((0u32 < 4000000000u32));
|
|
|
|
assert!((0u32 <= 4000000000u32));
|
|
|
|
assert!((4000000000u32 > 0u32));
|
|
|
|
assert!((4000000000u32 >= 0u32));
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(4000000000u32 / 10u32, 400000000u32);
|
|
|
|
assert_eq!(4000000005u32 % 10u32, 5u32);
|
2011-06-15 11:19:50 -07:00
|
|
|
// 64-bit numbers have some flakiness yet. Not tested
|
2011-02-13 00:49:04 -05:00
|
|
|
|
2011-08-19 15:16:48 -07:00
|
|
|
}
|