1 use std::cmp::Ordering::{Equal, Less, Greater};
12 fn test_partial_eq() {
13 let (small, big) = ((1, 2, 3), (3, 2, 1));
14 assert_eq!(small, small);
16 assert_ne!(small, big);
17 assert_ne!(big, small);
21 fn test_partial_ord() {
22 let (small, big) = ((1, 2, 3), (3, 2, 1));
25 assert!(!(small < small));
26 assert!(!(big < small));
27 assert!(!(big < big));
29 assert!(small <= small);
33 assert!(small >= small);
34 assert!(big >= small);
37 assert!(!((1.0f64, 2.0f64) < (NAN, 3.0)));
38 assert!(!((1.0f64, 2.0f64) <= (NAN, 3.0)));
39 assert!(!((1.0f64, 2.0f64) > (NAN, 3.0)));
40 assert!(!((1.0f64, 2.0f64) >= (NAN, 3.0)));
41 assert!(((1.0f64, 2.0f64) < (2.0, NAN)));
42 assert!(!((2.0f64, 2.0f64) < (2.0, NAN)));
47 let (small, big) = ((1, 2, 3), (3, 2, 1));
48 assert_eq!(small.cmp(&small), Equal);
49 assert_eq!(big.cmp(&big), Equal);
50 assert_eq!(small.cmp(&big), Less);
51 assert_eq!(big.cmp(&small), Greater);
56 let s = format!("{:?}", (1,));
57 assert_eq!(s, "(1,)");
58 let s = format!("{:?}", (1, true));
59 assert_eq!(s, "(1, true)");
60 let s = format!("{:?}", (1, "hi", true));
61 assert_eq!(s, "(1, \"hi\", true)");