summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-08-12 12:47:44 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-08-12 12:47:58 +0200
commita4f0666c74624f65cffa3880297f951802006ef7 (patch)
treeaa044770dcf23784dc5594cf7518b2660b1d6654
parent99a6e7820b22c8eb49d957a4c9e947d6185ac4fd (diff)
Add test for Filter::xor()
-rw-r--r--src/filter.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/filter.rs b/src/filter.rs
index 1491165..c2b887e 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -207,6 +207,15 @@ mod test {
}
#[test]
+ fn xor_filter() {
+ let a = (|&a: &usize| a == 0).xor(|&a: &usize| a == 3);
+
+ assert_eq!(a.filter(&3), true);
+ assert_eq!(a.filter(&5), false);
+ assert_eq!(a.filter(&0), true);
+ }
+
+ #[test]
fn complex_filter() {
let a = (|&a: &usize|{ a > 5 }).and_not(|&a: &usize| a < 20).or(|&a: &usize| a == 10);
// We now have ((a > 5) && !(a < 20) ) || a == 10