]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-fulldeps/syntax-extension-fourcc.rs
Honor hidden doc attribute of derivable trait methods
[rust.git] / src / test / run-pass-fulldeps / syntax-extension-fourcc.rs
1 // Copyright 2014 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.
4 //
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.
10
11 // ignore-stage1
12 // ignore-pretty
13 // ignore-cross-compile
14
15 #![feature(phase)]
16
17 #[phase(syntax)]
18 extern crate fourcc;
19
20 static static_val: u32 = fourcc!("foo ");
21 static static_val_be: u32 = fourcc!("foo ", big);
22 static static_val_le: u32 = fourcc!("foo ", little);
23 static static_val_target: u32 = fourcc!("foo ", target);
24
25 fn main() {
26     let val = fourcc!("foo ", big);
27     assert_eq!(val, 0x666f6f20u32);
28     assert_eq!(val, fourcc!("foo "));
29
30     let val = fourcc!("foo ", little);
31     assert_eq!(val, 0x206f6f66u32);
32
33     let val = fourcc!("foo ", target);
34     let exp = if cfg!(target_endian = "big") { 0x666f6f20u32 } else { 0x206f6f66u32 };
35     assert_eq!(val, exp);
36
37     assert_eq!(static_val_be, 0x666f6f20u32);
38     assert_eq!(static_val, static_val_be);
39     assert_eq!(static_val_le, 0x206f6f66u32);
40     let exp = if cfg!(target_endian = "big") { 0x666f6f20u32 } else { 0x206f6f66u32 };
41     assert_eq!(static_val_target, exp);
42
43     assert_eq!(fourcc!("\xC0\xFF\xEE!"), 0xC0FFEE21);
44 }