• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 5672512448

pending completion
5672512448

push

github

web-flow
chore: Change `make_from!` in `from_arrow` to func to improve readability (#1792)

31 of 31 new or added lines in 4 files covered. (100.0%)

45630 of 59777 relevant lines covered (76.33%)

38810.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.45
/dozer-sql/src/pipeline/expression/tests/logical.rs
1
use crate::pipeline::expression::execution::Expression::Literal;
2
use crate::pipeline::expression::logical::{evaluate_and, evaluate_not, evaluate_or};
3
use dozer_core::processor_record::ProcessorRecord;
4
use dozer_types::types::{Field, Schema};
5
use dozer_types::{ordered_float::OrderedFloat, rust_decimal::Decimal};
6
#[cfg(test)]
7
use proptest::prelude::*;
8

9
#[test]
1✔
10
fn test_logical() {
1✔
11
    proptest!(
2,000✔
12
        ProptestConfig::with_cases(1000),
2,000✔
13
        move |(bool1: bool, bool2: bool, u_num: u64, i_num: i64, f_num: f64, str in ".*")| {
2,000✔
14
        _test_bool_bool_and(bool1, bool2);
2,000✔
15
        _test_bool_null_and(Field::Boolean(bool1), Field::Null);
2,000✔
16
        _test_bool_null_and(Field::Null, Field::Boolean(bool1));
2,000✔
17

2,000✔
18
        _test_bool_bool_or(bool1, bool2);
2,000✔
19
        _test_bool_null_or(bool1);
2,000✔
20
        _test_null_bool_or(bool2);
2,000✔
21

2,000✔
22
        _test_bool_not(bool2);
2,000✔
23

2,000✔
24
        _test_bool_non_bool_and(Field::UInt(u_num), Field::Boolean(bool1));
2,000✔
25
        _test_bool_non_bool_and(Field::Int(i_num), Field::Boolean(bool1));
2,000✔
26
        _test_bool_non_bool_and(Field::Float(OrderedFloat(f_num)), Field::Boolean(bool1));
2,000✔
27
        _test_bool_non_bool_and(Field::Decimal(Decimal::from(u_num)), Field::Boolean(bool1));
2,000✔
28
        _test_bool_non_bool_and(Field::String(str.clone()), Field::Boolean(bool1));
2,000✔
29
        _test_bool_non_bool_and(Field::Text(str.clone()), Field::Boolean(bool1));
2,000✔
30

2,000✔
31
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::UInt(u_num));
2,000✔
32
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::Int(i_num));
2,000✔
33
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::Float(OrderedFloat(f_num)));
2,000✔
34
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::Decimal(Decimal::from(u_num)));
2,000✔
35
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::String(str.clone()));
2,000✔
36
        _test_bool_non_bool_and(Field::Boolean(bool2), Field::Text(str.clone()));
2,000✔
37

2,000✔
38
        _test_bool_non_bool_or(Field::UInt(u_num), Field::Boolean(bool1));
2,000✔
39
        _test_bool_non_bool_or(Field::Int(i_num), Field::Boolean(bool1));
2,000✔
40
        _test_bool_non_bool_or(Field::Float(OrderedFloat(f_num)), Field::Boolean(bool1));
2,000✔
41
        _test_bool_non_bool_or(Field::Decimal(Decimal::from(u_num)), Field::Boolean(bool1));
2,000✔
42
        _test_bool_non_bool_or(Field::String(str.clone()), Field::Boolean(bool1));
2,000✔
43
        _test_bool_non_bool_or(Field::Text(str.clone()), Field::Boolean(bool1));
2,000✔
44

2,000✔
45
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::UInt(u_num));
2,000✔
46
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::Int(i_num));
2,000✔
47
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::Float(OrderedFloat(f_num)));
2,000✔
48
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::Decimal(Decimal::from(u_num)));
2,000✔
49
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::String(str.clone()));
2,000✔
50
        _test_bool_non_bool_or(Field::Boolean(bool2), Field::Text(str));
2,000✔
51
    });
2,000✔
52
}
1✔
53

54
fn _test_bool_bool_and(bool1: bool, bool2: bool) {
1,000✔
55
    let row = ProcessorRecord::new();
1,000✔
56
    let l = Box::new(Literal(Field::Boolean(bool1)));
1,000✔
57
    let r = Box::new(Literal(Field::Boolean(bool2)));
1,000✔
58
    assert!(matches!(
1,000✔
59
        evaluate_and(&Schema::default(), &l, &r, &row)
1,000✔
60
            .unwrap_or_else(|e| panic!("{}", e.to_string())),
1,000✔
61
        Field::Boolean(_ans)
1,000✔
62
    ));
×
63
}
1,000✔
64

65
fn _test_bool_null_and(f1: Field, f2: Field) {
2,000✔
66
    let row = ProcessorRecord::new();
2,000✔
67
    let l = Box::new(Literal(f1));
2,000✔
68
    let r = Box::new(Literal(f2));
2,000✔
69
    assert!(matches!(
2,000✔
70
        evaluate_and(&Schema::default(), &l, &r, &row)
2,000✔
71
            .unwrap_or_else(|e| panic!("{}", e.to_string())),
2,000✔
72
        Field::Boolean(false)
×
73
    ));
×
74
}
2,000✔
75

76
fn _test_bool_bool_or(bool1: bool, bool2: bool) {
1,000✔
77
    let row = ProcessorRecord::new();
1,000✔
78
    let l = Box::new(Literal(Field::Boolean(bool1)));
1,000✔
79
    let r = Box::new(Literal(Field::Boolean(bool2)));
1,000✔
80
    assert!(matches!(
1,000✔
81
        evaluate_or(&Schema::default(), &l, &r, &row)
1,000✔
82
            .unwrap_or_else(|e| panic!("{}", e.to_string())),
1,000✔
83
        Field::Boolean(_ans)
1,000✔
84
    ));
×
85
}
1,000✔
86

87
fn _test_bool_null_or(_bool: bool) {
1,000✔
88
    let row = ProcessorRecord::new();
1,000✔
89
    let l = Box::new(Literal(Field::Boolean(_bool)));
1,000✔
90
    let r = Box::new(Literal(Field::Null));
1,000✔
91
    assert!(matches!(
1,000✔
92
        evaluate_or(&Schema::default(), &l, &r, &row)
1,000✔
93
            .unwrap_or_else(|e| panic!("{}", e.to_string())),
1,000✔
94
        Field::Boolean(_bool)
1,000✔
95
    ));
×
96
}
1,000✔
97

98
fn _test_null_bool_or(_bool: bool) {
1,000✔
99
    let row = ProcessorRecord::new();
1,000✔
100
    let l = Box::new(Literal(Field::Null));
1,000✔
101
    let r = Box::new(Literal(Field::Boolean(_bool)));
1,000✔
102
    assert!(matches!(
1,000✔
103
        evaluate_or(&Schema::default(), &l, &r, &row)
1,000✔
104
            .unwrap_or_else(|e| panic!("{}", e.to_string())),
1,000✔
105
        Field::Boolean(_bool)
1,000✔
106
    ));
×
107
}
1,000✔
108

109
fn _test_bool_not(bool: bool) {
1,000✔
110
    let row = ProcessorRecord::new();
1,000✔
111
    let v = Box::new(Literal(Field::Boolean(bool)));
1,000✔
112
    assert!(matches!(
1,000✔
113
        evaluate_not(&Schema::default(), &v, &row).unwrap_or_else(|e| panic!("{}", e.to_string())),
1,000✔
114
        Field::Boolean(_ans)
1,000✔
115
    ));
×
116
}
1,000✔
117

118
fn _test_bool_non_bool_and(f1: Field, f2: Field) {
12,000✔
119
    let row = ProcessorRecord::new();
12,000✔
120
    let l = Box::new(Literal(f1));
12,000✔
121
    let r = Box::new(Literal(f2));
12,000✔
122
    assert!(evaluate_and(&Schema::default(), &l, &r, &row).is_err());
12,000✔
123
}
12,000✔
124

×
125
fn _test_bool_non_bool_or(f1: Field, f2: Field) {
12,000✔
126
    let row = ProcessorRecord::new();
12,000✔
127
    let l = Box::new(Literal(f1));
12,000✔
128
    let r = Box::new(Literal(f2));
12,000✔
129
    assert!(evaluate_or(&Schema::default(), &l, &r, &row).is_err());
12,000✔
130
}
12,000✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc