1 // Checks that in a derived implementation of PartialOrd the lt, le, ge, gt methods are consistent
2 // with partial_cmp. Also verifies that implementation is consistent with that for tuples.
6 #[derive(PartialEq, PartialOrd)]
10 let values: &[f64] = &[1.0, 2.0, f64::NAN];
15 // Check impl for a tuple.
16 check(&(*a, *b), &(*c, *d));
18 // Check derived impl.
19 check(&P(*a, *b), &P(*c, *d));
21 // Check that impls agree with each other.
23 PartialOrd::partial_cmp(&(*a, *b), &(*c, *d)),
24 PartialOrd::partial_cmp(&P(*a, *b), &P(*c, *d)),
32 fn check<T: PartialOrd>(a: &T, b: &T) {
33 use std::cmp::Ordering::*;
34 match PartialOrd::partial_cmp(a, b) {