diff options
author | Daniel <kingdread@gmx.de> | 2020-06-12 01:11:51 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-06-12 01:11:51 +0200 |
commit | 8d1aece508b76497daa04a90c00967b543d1741b (patch) | |
tree | 9aa17fb58cb74b329f0fe7cdb1bb9517f14d6fb6 /src/filters | |
parent | e7449ee3883709320978526637720d46f16ff09d (diff) | |
download | raidgrep-8d1aece508b76497daa04a90c00967b543d1741b.tar.gz raidgrep-8d1aece508b76497daa04a90c00967b543d1741b.tar.bz2 raidgrep-8d1aece508b76497daa04a90c00967b543d1741b.zip |
add tests for CompOp::matches
Diffstat (limited to 'src/filters')
-rw-r--r-- | src/filters/values.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/filters/values.rs b/src/filters/values.rs index 3109ef4..141aecd 100644 --- a/src/filters/values.rs +++ b/src/filters/values.rs @@ -193,3 +193,31 @@ impl Producer for DurationProducer { pub fn duration() -> Box<dyn Producer<Output = Duration>> { Box::new(DurationProducer) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_compop_matches() { + assert!(CompOp::Less.matches(Ordering::Less)); + assert!(!CompOp::Less.matches(Ordering::Equal)); + assert!(!CompOp::Less.matches(Ordering::Greater)); + + assert!(CompOp::LessEqual.matches(Ordering::Less)); + assert!(CompOp::LessEqual.matches(Ordering::Equal)); + assert!(!CompOp::LessEqual.matches(Ordering::Greater)); + + assert!(!CompOp::Equal.matches(Ordering::Less)); + assert!(CompOp::Equal.matches(Ordering::Equal)); + assert!(!CompOp::Equal.matches(Ordering::Greater)); + + assert!(!CompOp::GreaterEqual.matches(Ordering::Less)); + assert!(CompOp::GreaterEqual.matches(Ordering::Equal)); + assert!(CompOp::GreaterEqual.matches(Ordering::Greater)); + + assert!(!CompOp::Greater.matches(Ordering::Less)); + assert!(!CompOp::Greater.matches(Ordering::Equal)); + assert!(CompOp::Greater.matches(Ordering::Greater)); + } +} |