1 use std::cmp::Ordering::{Equal, Greater, Less};
11 fn test_partial_eq() {
12 let (small, big) = ((1, 2, 3), (3, 2, 1));
13 assert_eq!(small, small);
15 assert_ne!(small, big);
16 assert_ne!(big, small);
20 fn test_partial_ord() {
21 let (small, big) = ((1, 2, 3), (3, 2, 1));
24 assert!(!(small < small));
25 assert!(!(big < small));
26 assert!(!(big < big));
28 assert!(small <= small);
32 assert!(small >= small);
33 assert!(big >= small);
36 assert!(!((1.0f64, 2.0f64) < (f64::NAN, 3.0)));
37 assert!(!((1.0f64, 2.0f64) <= (f64::NAN, 3.0)));
38 assert!(!((1.0f64, 2.0f64) > (f64::NAN, 3.0)));
39 assert!(!((1.0f64, 2.0f64) >= (f64::NAN, 3.0)));
40 assert!(((1.0f64, 2.0f64) < (2.0, f64::NAN)));
41 assert!(!((2.0f64, 2.0f64) < (2.0, f64::NAN)));
46 let (small, big) = ((1, 2, 3), (3, 2, 1));
47 assert_eq!(small.cmp(&small), Equal);
48 assert_eq!(big.cmp(&big), Equal);
49 assert_eq!(small.cmp(&big), Less);
50 assert_eq!(big.cmp(&small), Greater);
55 let s = format!("{:?}", (1,));
56 assert_eq!(s, "(1,)");
57 let s = format!("{:?}", (1, true));
58 assert_eq!(s, "(1, true)");
59 let s = format!("{:?}", (1, "hi", true));
60 assert_eq!(s, "(1, \"hi\", true)");