2014-01-30 19:05:04 -06:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
2013-09-16 21:30:28 -05:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-02-07 13:08:32 -06:00
|
|
|
// ignore-stage1
|
|
|
|
// ignore-pretty
|
2014-01-30 19:05:04 -06:00
|
|
|
|
2014-04-03 19:55:06 -05:00
|
|
|
#![feature(phase)]
|
2014-01-30 19:05:04 -06:00
|
|
|
|
|
|
|
#[phase(syntax)]
|
2014-02-14 12:10:06 -06:00
|
|
|
extern crate fourcc;
|
2014-01-30 19:05:04 -06:00
|
|
|
|
2013-09-16 21:30:28 -05:00
|
|
|
static static_val: u32 = fourcc!("foo ");
|
|
|
|
static static_val_be: u32 = fourcc!("foo ", big);
|
2014-02-06 13:41:49 -06:00
|
|
|
static static_val_le: u32 = fourcc!("foo ", little);
|
|
|
|
static static_val_target: u32 = fourcc!("foo ", target);
|
2013-09-16 21:30:28 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let val = fourcc!("foo ", big);
|
|
|
|
assert_eq!(val, 0x666f6f20u32);
|
2014-02-06 13:41:49 -06:00
|
|
|
assert_eq!(val, fourcc!("foo "));
|
2013-09-16 21:30:28 -05:00
|
|
|
|
|
|
|
let val = fourcc!("foo ", little);
|
|
|
|
assert_eq!(val, 0x206f6f66u32);
|
|
|
|
|
2014-02-06 13:41:49 -06:00
|
|
|
let val = fourcc!("foo ", target);
|
2013-09-16 21:30:28 -05:00
|
|
|
let exp = if cfg!(target_endian = "big") { 0x666f6f20u32 } else { 0x206f6f66u32 };
|
2014-02-06 13:41:49 -06:00
|
|
|
assert_eq!(val, exp);
|
|
|
|
|
2013-09-16 21:30:28 -05:00
|
|
|
assert_eq!(static_val_be, 0x666f6f20u32);
|
2014-02-06 13:41:49 -06:00
|
|
|
assert_eq!(static_val, static_val_be);
|
|
|
|
assert_eq!(static_val_le, 0x206f6f66u32);
|
|
|
|
let exp = if cfg!(target_endian = "big") { 0x666f6f20u32 } else { 0x206f6f66u32 };
|
|
|
|
assert_eq!(static_val_target, exp);
|
2014-02-06 15:14:42 -06:00
|
|
|
|
|
|
|
assert_eq!(fourcc!("\xC0\xFF\xEE!"), 0xC0FFEE21);
|
2013-09-16 21:30:28 -05:00
|
|
|
}
|