pub fn lt<ExpectedT>(expected: ExpectedT) -> LtMatcher<ExpectedT>Expand description
Matches a value less (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!(1, lt(2))?; // Passes
verify_that!(2, lt(2))?; // 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, lt(0u64))?; // Does not compile
verify_that!(123u32 as u64, lt(100000000u64))?; // Passesⓘ
let actual: &u32 = &2;
let expected: u32 = 70;
verify_that!(actual, lt(expected))?; // Does not compilelet actual: &u32 = &2;
let expected: u32 = 70;
verify_that!(actual, lt(&expected))?; // Compiles and passesYou can find the standard library PartialOrd implementation in
https://doc.rust-lang.org/core/cmp/trait.PartialOrd.html#implementors