1 | use predicates::prelude::*; |
2 | use predicates_tree::CaseTreeExt; |
3 | |
4 | fn main() { |
5 | let expected = 10; |
6 | let actual = 15; |
7 | let pred = predicates::ord::eq(expected); |
8 | if let Some(case) = pred.find_case(false, &actual) { |
9 | let tree = case.tree(); |
10 | println!("{}" , tree); |
11 | } |
12 | |
13 | let expected = [1, 2, 3]; |
14 | let actual = 15; |
15 | let pred = predicates::iter::in_iter(IntoIterator::into_iter(expected)); |
16 | if let Some(case) = pred.find_case(false, &actual) { |
17 | let tree = case.tree(); |
18 | println!("{}" , tree); |
19 | } |
20 | |
21 | let expected = "Hello |
22 | World! |
23 | |
24 | Goodbye!" ; |
25 | let actual = "Hello |
26 | Moon! |
27 | |
28 | Goodbye!" ; |
29 | let pred = predicates::ord::eq(expected); |
30 | if let Some(case) = pred.find_case(false, &actual) { |
31 | let tree = case.tree(); |
32 | println!("{}" , tree); |
33 | } |
34 | |
35 | let expected = "Hello |
36 | World! |
37 | |
38 | Goodbye!" ; |
39 | let actual = "Hello |
40 | Moon! |
41 | |
42 | Goodbye!" ; |
43 | let pred = predicates::str::diff(expected); |
44 | if let Some(case) = pred.find_case(false, actual) { |
45 | let tree = case.tree(); |
46 | println!("{}" , tree); |
47 | } |
48 | } |
49 | |