1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(macro_rules)]
14 ($m:ident, $t:ty, $v:expr) => {{
16 use std::mem::size_of;
25 assert_eq!(size_of::<E>(), size_of::<$t>());
26 assert_eq!(E::V as $t, $v as $t);
27 assert_eq!(C as $t, $v as $t);
28 assert_eq!(format!("{}", E::V), "V".to_string());
29 assert_eq!(format!("{}", C), "V".to_string());
39 check!(c, u16, 0x1727);
40 check!(d, u16, 0xe8d8);
41 check!(e, u32, 0x17273747);
42 check!(f, u32, 0xe8d8c8b8);
46 check!(x, i16, 0x1727);
47 check!(w, i16, -0x1727);
48 check!(v, i32, 0x17273747);
49 check!(u, i32, -0x17273747);
52 assert_eq!(::std::mem::size_of::<Simple>(), 1);