in src/metrics/abc.rs [843:878]
fn java_while_and_do_while_conditions() {
check_metrics::<JavaParser>(
"
while ( (!(!(!(a)))) ) {} // +1c
while ( b || 1 > 2 ) {} // +2c
while ( x.m() && (((c))) ) {} // +1b +2c
do {} while ( !!!(((!!!a))) ); // +1c
do {} while ( a || (b && c) ); // +3c
do {} while ( !x.m() && 1 > 2 || !true ); // +1b +3c
",
"foo.java",
|metric| {
// magnitude: sqrt(0 + 4 + 144) = sqrt(148)
// space count: 1 (1 unit)
insta::assert_json_snapshot!(
metric.abc,
@r###"
{
"assignments": 0.0,
"branches": 2.0,
"conditions": 12.0,
"magnitude": 12.165525060596439,
"assignments_average": 0.0,
"branches_average": 2.0,
"conditions_average": 12.0,
"assignments_min": 0.0,
"assignments_max": 0.0,
"branches_min": 2.0,
"branches_max": 2.0,
"conditions_min": 12.0,
"conditions_max": 12.0
}"###
);
},
);
}