]>
git.proxmox.com Git - rustc.git/blob - src/libcoretest/tuple.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.
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 use std
::cmp
::Ordering
::{Equal, Less, Greater}
;
22 let (small
, big
) = ((1, 2, 3), (3, 2, 1));
27 assert_eq
!(small
, small
);
29 assert
!(small
!= big
);
30 assert
!(big
!= small
);
34 assert
!(!(small
< small
));
35 assert
!(!(big
< small
));
36 assert
!(!(big
< big
));
38 assert
!(small
<= small
);
42 assert
!(small
>= small
);
43 assert
!(big
>= small
);
46 assert
!(!((1.0f64, 2.0f64) < (nan
, 3.0)));
47 assert
!(!((1.0f64, 2.0f64) <= (nan
, 3.0)));
48 assert
!(!((1.0f64, 2.0f64) > (nan
, 3.0)));
49 assert
!(!((1.0f64, 2.0f64) >= (nan
, 3.0)));
50 assert
!(((1.0f64, 2.0f64) < (2.0, nan
)));
51 assert
!(!((2.0f64, 2.0f64) < (2.0, nan
)));
54 assert
!(small
.cmp(&small
) == Equal
);
55 assert
!(big
.cmp(&big
) == Equal
);
56 assert
!(small
.cmp(&big
) == Less
);
57 assert
!(big
.cmp(&small
) == Greater
);
62 let s
= format
!("{:?}", (1,));
63 assert_eq
!(s
, "(1,)");
64 let s
= format
!("{:?}", (1, true));
65 assert_eq
!(s
, "(1, true)");
66 let s
= format
!("{:?}", (1, "hi", true));
67 assert_eq
!(s
, "(1, \"hi\", true)");