pub fn gt<ExpectedT: Debug>(expected: ExpectedT) -> GtMatcher<ExpectedT>Expand description
Matches a value greater (in the sense of >) than expected.
The types of ActualT of actual and ExpectedT of expected must be
comparable via the PartialOrd trait. Namely, ActualT must implement
PartialOrd<ExpectedT>.
verify_that!(38, gt(1))?; // Passes
verify_that!(234, gt(234))?; // FailsIn most cases the params neeed to be the same type or they need to be cast explicitly. This can be surprising when comparing integer types or references:
ⓘ
verify_that!(123u32, gt(0u64))?; // Does not compile
verify_that!(123u32 as u64, gt(0u64))?; // Passesⓘ
let actual: &u32 = &2;
let expected: u32 = 1;
verify_that!(actual, gt(expected))?; // Does not compilelet actual: &u32 = &2;
let expected: u32 = 1;
verify_that!(actual, gt(&expected))?; // Compiles and passesYou can find the standard library PartialOrd implementation in
https://doc.rust-lang.org/core/cmp/trait.PartialOrd.html#implementors