]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/numeric-method-autoexport.rs
Imported Upstream version 0.6
[rustc.git] / src / test / run-pass / numeric-method-autoexport.rs
1 // xfail-pretty
2
3 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
4 // file at the top-level directory of this distribution and at
5 // http://rust-lang.org/COPYRIGHT.
6 //
7 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10 // option. This file may not be copied, modified, or distributed
11 // except according to those terms.
12
13 // This file is intended to test only that methods are automatically
14 // reachable for each numeric type, for each exported impl, with no imports
15 // necessary. Testing the methods of the impls is done within the source
16 // file for each numeric type.
17 pub fn main() {
18 // ints
19 // num
20 assert!(15i.add(&6) == 21);
21 assert!(15i8.add(&6i8) == 21i8);
22 assert!(15i16.add(&6i16) == 21i16);
23 assert!(15i32.add(&6i32) == 21i32);
24 assert!(15i64.add(&6i64) == 21i64);
25
26 // uints
27 // num
28 assert!(15u.add(&6u) == 21u);
29 assert!(15u8.add(&6u8) == 21u8);
30 assert!(15u16.add(&6u16) == 21u16);
31 assert!(15u32.add(&6u32) == 21u32);
32 assert!(15u64.add(&6u64) == 21u64);
33
34 // times
35 15u.times(|| false);
36
37 // floats
38 // num
39 assert!(10f.to_int() == 10);
40 assert!(10f32.to_int() == 10);
41 assert!(10f64.to_int() == 10);
42 }