in src/metrics/abc.rs [799:840]
fn java_if_multiple_conditions() {
check_metrics::<JavaParser>(
"
if ( a || b || c || d ) {} // +4c
if ( a || b && c && d ) {} // +4c
if ( x < y && a == b ) {} // +2c
if ( ((z < (x + y))) ) {} // +1c
if ( a || ((((b))) && c) ) {} // +3c
if ( a && ((((a == b))) && c) ) {} // +3c
if ( a || ((((a == b))) || ((c))) ) {} // +3c
if ( x < y && B.m() ) {} // +1b +2c
if ( x < y && !(((B.m()))) ) {} // +1b +2c
if ( !(x < y) && !B.m() ) {} // +1b +2c
if ( !!!(!!!(a)) && B.m() || // +1b +2c
!B.m() && (((x > 4))) ) {} // +1b +2c
",
"foo.java",
|metric| {
// magnitude: sqrt(0 + 25 + 900) = sqrt(925)
// space count: 1 (1 unit)
insta::assert_json_snapshot!(
metric.abc,
@r###"
{
"assignments": 0.0,
"branches": 5.0,
"conditions": 30.0,
"magnitude": 30.4138126514911,
"assignments_average": 0.0,
"branches_average": 5.0,
"conditions_average": 30.0,
"assignments_min": 0.0,
"assignments_max": 0.0,
"branches_min": 5.0,
"branches_max": 5.0,
"conditions_min": 30.0,
"conditions_max": 30.0
}"###
);
},
);
}