|
5 | 5 | pub use and::And;
|
6 | 6 | pub use not::Not;
|
7 | 7 | pub use or::Or;
|
8 |
| - |
9 |
| -#[cfg(test)] |
10 |
| -mod test { |
11 |
| - // use crate::rule::composer::{And, Not, Or}; |
12 |
| - // use crate::rule::{LessI8Rule, MoreI8Rule, Rule}; |
13 |
| - // |
14 |
| - // #[test] |
15 |
| - // fn test_and_or_not() { |
16 |
| - // let less_than_3 = LessI8Rule::new(3); |
17 |
| - // let more_than_1 = MoreI8Rule::new(1); |
18 |
| - // |
19 |
| - // // (1 <= x <= 3) |
20 |
| - // let more_than_1_and_less_than_3 = And::new(less_than_3, more_than_1); |
21 |
| - // |
22 |
| - // assert!(more_than_1_and_less_than_3.validate(0).is_err()); |
23 |
| - // assert!(more_than_1_and_less_than_3.validate(2).is_ok()); |
24 |
| - // assert!(more_than_1_and_less_than_3.validate(4).is_err()); |
25 |
| - // |
26 |
| - // let more_than_5 = MoreI8Rule::new(5); |
27 |
| - // |
28 |
| - // // (1 <= x <= 3) or (5 <= x) |
29 |
| - // let or_more_than_5 = Or::new(more_than_1_and_less_than_3, more_than_5); |
30 |
| - // |
31 |
| - // assert!(or_more_than_5.validate(0).is_err()); |
32 |
| - // assert!(or_more_than_5.validate(2).is_ok()); |
33 |
| - // assert!(or_more_than_5.validate(4).is_err()); |
34 |
| - // assert!(or_more_than_5.validate(5).is_ok()); |
35 |
| - // assert!(or_more_than_5.validate(100).is_ok()); |
36 |
| - // |
37 |
| - // let more_than_7 = MoreI8Rule::new(7); |
38 |
| - // |
39 |
| - // // ((1 <= x <= 3) or (5 <= x)) & (x < 7) |
40 |
| - // let not_more_than_7 = And::new(or_more_than_5, Not::new(more_than_7)); |
41 |
| - // |
42 |
| - // assert!(not_more_than_7.validate(0).is_err()); |
43 |
| - // assert!(not_more_than_7.validate(2).is_ok()); |
44 |
| - // assert!(not_more_than_7.validate(4).is_err()); |
45 |
| - // assert!(not_more_than_7.validate(5).is_ok()); |
46 |
| - // assert!(not_more_than_7.validate(100).is_err()); |
47 |
| - // } |
48 |
| -} |
0 commit comments