]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/numeric-method-autoexport.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / run-pass / numeric-method-autoexport.rs
CommitLineData
1a4d82fc 1// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
223e47cc
LB
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// This file is intended to test only that methods are automatically
12// reachable for each numeric type, for each exported impl, with no imports
13// necessary. Testing the methods of the impls is done within the source
14// file for each numeric type.
1a4d82fc
JJ
15
16use std::ops::Add;
1a4d82fc 17
223e47cc
LB
18pub fn main() {
19// ints
20 // num
85aaf69f
SL
21 assert_eq!(15_isize.add(6_isize), 21_isize);
22 assert_eq!(15_i8.add(6i8), 21_i8);
23 assert_eq!(15_i16.add(6i16), 21_i16);
24 assert_eq!(15_i32.add(6i32), 21_i32);
25 assert_eq!(15_i64.add(6i64), 21_i64);
223e47cc
LB
26
27// uints
28 // num
85aaf69f
SL
29 assert_eq!(15_usize.add(6_usize), 21_usize);
30 assert_eq!(15_u8.add(6u8), 21_u8);
31 assert_eq!(15_u16.add(6u16), 21_u16);
32 assert_eq!(15_u32.add(6u32), 21_u32);
33 assert_eq!(15_u64.add(6u64), 21_u64);
223e47cc 34}