aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-06-12 01:11:51 +0200
committerDaniel <kingdread@gmx.de>2020-06-12 01:11:51 +0200
commit8d1aece508b76497daa04a90c00967b543d1741b (patch)
tree9aa17fb58cb74b329f0fe7cdb1bb9517f14d6fb6
parente7449ee3883709320978526637720d46f16ff09d (diff)
downloadraidgrep-8d1aece508b76497daa04a90c00967b543d1741b.tar.gz
raidgrep-8d1aece508b76497daa04a90c00967b543d1741b.tar.bz2
raidgrep-8d1aece508b76497daa04a90c00967b543d1741b.zip
add tests for CompOp::matches
-rw-r--r--src/filters/values.rs28
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));
+ }
+}