Skip to content

Commit

Permalink
Pass literal through black_box
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jun 3, 2018
1 parent 490c57b commit 7df0099
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/test/run-pass/const-endianess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
// except according to those terms.

#![feature(const_int_ops)]
#![feature(test)]

extern crate test;
use test::black_box as b;

const BE_U32: u32 = 55u32.to_be();
const LE_U32: u32 = 55u32.to_le();
const BE_U128: u128 = 999999u128.to_be();
const LE_I128: i128 = -999999i128.to_le();

fn main() {
assert_eq!(BE_U32, 55u32.to_be());
assert_eq!(LE_U32, 55u32.to_le());
assert_eq!(BE_U128, 999999u128.to_be());
assert_eq!(LE_I128, -999999i128.to_le());
assert_eq!(BE_U32, b(55u32).to_be());
assert_eq!(LE_U32, b(55u32).to_le());
assert_eq!(BE_U128, b(999999u128).to_be());
assert_eq!(LE_I128, b(-999999i128).to_le());
}

0 comments on commit 7df0099

Please sign in to comment.