aboutsummaryrefslogtreecommitdiff
path: root/src/filters
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters')
-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));
+ }
+}