1mod common;
2use common::guard_test;
3use rest::prelude::*;
4
5fn main() {
6 config().enhanced_output(true).apply();
8
9 println!("\n=== Testing AND modifier (all true) ===");
10 let number = 42;
11 expect!(number).to_be_greater_than(30).and().to_be_less_than(50);
13
14 println!("\n=== Testing complex AND chain (passing) ===");
15 expect!(number).to_be_even().and().to_be_positive();
17
18 println!("\n=== Testing failing OR chain with passing part ===");
19 expect!(number).to_be_greater_than(50).or().to_be_less_than(30).or().to_equal(42);
21
22 println!("\n=== Testing OR chain (all false) ===");
23 let success = guard_test(|| {
25 expect!(number).to_be_greater_than(50).or().to_be_less_than(30).or().to_be_greater_than(100);
26 });
27
28 if !success {
29 println!("Test failed as expected (all conditions were false)");
30 }
31
32 println!("\n=== Testing combined NOT with AND ===");
33 expect!(number).not().to_be_less_than(30).and().not().to_be_greater_than(50);
35
36 println!("\n=== Testing string matchers with AND ===");
37 let name = "Arthur";
39 expect!(name).to_contain("th").and().to_have_length(6).and().not().to_be_empty();
40
41 println!("\n=== Test Summary ===");
43 rest::Reporter::summarize();
44}