2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2015-01-02 16:44:21 -06:00
|
|
|
macro_rules! assert_approx_eq {
|
2014-01-08 05:57:31 -06:00
|
|
|
($a:expr, $b:expr) => ({
|
|
|
|
let (a, b) = (&$a, &$b);
|
|
|
|
assert!((*a - *b).abs() < 1.0e-6,
|
|
|
|
"{} is not approximately equal to {}", *a, *b);
|
|
|
|
})
|
2015-01-02 16:44:21 -06:00
|
|
|
}
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static A: isize = -4 + 3;
|
|
|
|
static A2: usize = 3 + 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
static B: f64 = 3.0 + 2.7;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static C: isize = 3 - 4;
|
|
|
|
static D: usize = 3 - 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
static E: f64 = 3.0 - 2.7;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static E2: isize = -3 * 3;
|
|
|
|
static F: usize = 3 * 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
static G: f64 = 3.3 * 3.3;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static H: isize = 3 / -1;
|
|
|
|
static I: usize = 3 / 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
static J: f64 = 3.3 / 3.3;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
static N: bool = true && false;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
static O: bool = true || false;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static P: isize = 3 & 1;
|
|
|
|
static Q: usize = 1 & 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static R: isize = 3 | 1;
|
|
|
|
static S: usize = 1 | 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static T: isize = 3 ^ 1;
|
|
|
|
static U: usize = 1 ^ 3;
|
2014-01-08 05:57:31 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
static V: isize = 1 << 3;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
|
|
|
// NOTE: better shr coverage
|
2015-03-25 19:06:52 -05:00
|
|
|
static W: isize = 1024 >> 4;
|
|
|
|
static X: usize = 1024 >> 4;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static Y: bool = 1 == 1;
|
2014-06-27 14:30:25 -05:00
|
|
|
static Z: bool = 1.0f64 == 1.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static AA: bool = 1 <= 2;
|
|
|
|
static AB: bool = -1 <= 2;
|
2014-06-27 14:30:25 -05:00
|
|
|
static AC: bool = 1.0f64 <= 2.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static AD: bool = 1 < 2;
|
|
|
|
static AE: bool = -1 < 2;
|
2014-06-27 14:30:25 -05:00
|
|
|
static AF: bool = 1.0f64 < 2.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static AG: bool = 1 != 2;
|
|
|
|
static AH: bool = -1 != 2;
|
2014-06-27 14:30:25 -05:00
|
|
|
static AI: bool = 1.0f64 != 2.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static AJ: bool = 2 >= 1;
|
|
|
|
static AK: bool = 2 >= -2;
|
2014-06-27 14:30:25 -05:00
|
|
|
static AL: bool = 1.0f64 >= -2.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
static AM: bool = 2 > 1;
|
|
|
|
static AN: bool = 2 > -2;
|
2014-06-27 14:30:25 -05:00
|
|
|
static AO: bool = 1.0f64 > -2.0;
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2013-09-25 02:43:37 -05:00
|
|
|
pub fn main() {
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(A, -1);
|
|
|
|
assert_eq!(A2, 6);
|
|
|
|
assert_approx_eq!(B, 5.7);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(C, -1);
|
|
|
|
assert_eq!(D, 0);
|
|
|
|
assert_approx_eq!(E, 0.3);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(E2, -9);
|
|
|
|
assert_eq!(F, 9);
|
|
|
|
assert_approx_eq!(G, 10.89);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(H, -3);
|
|
|
|
assert_eq!(I, 1);
|
|
|
|
assert_approx_eq!(J, 1.0);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(N, false);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(O, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(P, 1);
|
|
|
|
assert_eq!(Q, 1);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(R, 3);
|
|
|
|
assert_eq!(S, 3);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(T, 2);
|
|
|
|
assert_eq!(U, 2);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(V, 8);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(W, 64);
|
|
|
|
assert_eq!(X, 64);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(Y, true);
|
|
|
|
assert_eq!(Z, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(AA, true);
|
|
|
|
assert_eq!(AB, true);
|
|
|
|
assert_eq!(AC, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(AD, true);
|
|
|
|
assert_eq!(AE, true);
|
|
|
|
assert_eq!(AF, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(AG, true);
|
|
|
|
assert_eq!(AH, true);
|
|
|
|
assert_eq!(AI, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(AJ, true);
|
|
|
|
assert_eq!(AK, true);
|
|
|
|
assert_eq!(AL, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
|
2014-01-08 05:57:31 -06:00
|
|
|
assert_eq!(AM, true);
|
|
|
|
assert_eq!(AN, true);
|
|
|
|
assert_eq!(AO, true);
|
2013-05-19 15:03:52 -05:00
|
|
|
}
|