Branch Coverage

blib/lib/WebService/GrowthBook/Eval.pm
Criterion Covered Total %
branch 135 144 93.7


line true false branch
17 5 174 if (exists $condition->{'$or'})
21 4 170 if (exists $condition->{'$nor'})
24 7 163 if (exists $condition->{'$and'})
28 2 161 if (exists $condition->{'$not'})
34 91 72 unless (eval_condition_value($value, get_path($attributes, $key)))
47 168 7 if (ref $current eq 'HASH' and exists $current->{$segment}) { }
59 1 8 if (scalar @$conditions == 0)
64 6 6 if (eval_condition($attributes, $condition))
74 3 7 unless (eval_condition($attributes, $condition))
84 152 57 if (ref $condition_value eq "HASH" and is_operator_object($condition_value))
87 89 88 unless (eval_operator_condition($key, $attribute_value, $value))
93 5 52 if (ref $condition_value eq "ARRAY")
94 1 4 if (ref $attribute_value ne "ARRAY")
97 2 2 if (scalar @$condition_value != scalar @$attribute_value)
101 1 2 unless (eval_condition_value($condition_value->[$i], $attribute_value->[$i]))
108 4 48 if (ref $condition_value eq "HASH")
109 1 3 if (ref $attribute_value ne "HASH")
112 2 1 if (scalar keys %$condition_value != scalar keys %$attribute_value)
116 0 1 unless (exists $attribute_value->{$key})
119 0 1 unless (eval_condition_value($condition_value->{$key}, $attribute_value->{$key}))
126 2 46 if (not defined $condition_value || defined $attribute_value) { }
5 41 elsif (not defined $condition_value && defined $attribute_value) { }
139 8 209 if (substr($key, 0, 1) ne "\$")
148 0 52 if (&looks_like_number($va) and not defined $vb)
151 0 52 if (&looks_like_number($vb) and not defined $va)
154 34 18 if (&looks_like_number($va) and &looks_like_number($vb)) { }
163 10 167 if ($operator eq '$eq') { }
2 165 elsif ($operator eq '$ne') { }
7 158 elsif ($operator eq '$lt') { }
4 154 elsif ($operator eq '$lte') { }
25 129 elsif ($operator eq '$gt') { }
4 125 elsif ($operator eq '$gte') { }
2 123 elsif ($operator eq '$veq') { }
2 121 elsif ($operator eq '$vne') { }
10 111 elsif ($operator eq '$vlt') { }
8 103 elsif ($operator eq '$vlte') { }
13 90 elsif ($operator eq '$vgt') { }
8 82 elsif ($operator eq '$vgte') { }
14 68 elsif ($operator eq '$regex') { }
16 52 elsif ($operator eq '$in') { }
8 44 elsif ($operator eq '$nin') { }
11 33 elsif ($operator eq '$elemMatch') { }
9 24 elsif ($operator eq '$size') { }
3 21 elsif ($operator eq '$all') { }
4 17 elsif ($operator eq '$exists') { }
12 5 elsif ($operator eq '$type') { }
4 1 elsif ($operator eq '$not') { }
227 1 15 unless ref $condition_value eq "ARRAY"
230 1 7 unless ref $condition_value eq "ARRAY"
235 1 8 unless ref $attribute_value eq "ARRAY"
238 1 2 unless ref $attribute_value eq "ARRAY"
242 3 5 if (eval_condition_value($cond, $attr))
247 1 3 unless $passing
251 2 2 !$condition_value ? :
266 0 212 if (&looks_like_number($input))
270 0 212 if (not defined $input or ref $input or $input eq "")
281 130 82 if (scalar @parts == 3)
286 684 211 if (/^\d+$/) { }
293 1 21 unless defined $attribute_value
294 10 11 if (ref $attribute_value eq "ARRAY")
297 6 14 if exists $condition_hash{$item}
308 1 10 unless ref $attribute_value eq "ARRAY"
311 22 4 if (is_operator_object($condition)) { }
312 4 18 if (eval_condition_value($condition, $item))
316 1 3 if (eval_condition($item, $condition))
327 1 11 unless (defined $attribute_value)
330 8 3 if (ref $attribute_value eq "")
331 6 2 if ($attribute_value =~ /^[+-]?\d+$/ or $attribute_value =~ /^[+-]?\d*\.\d+$/)
336 1 2 if (is_bool($attribute_value))
339 1 1 if (ref $attribute_value eq "ARRAY")
342 1 0 if (ref $attribute_value eq "HASH")
345 0 0 if (ref $attribute_value eq "SCALAR" and $$attribute_value eq '0' || $$attribute_value eq '1')