Skip to content

Commit a2fec86

Browse files
committed
Finalizes tests
1 parent c94f8ba commit a2fec86

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/metrics/exit.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ impl Exit for CppCode {
175175
impl Exit for JavaCode {
176176
fn compute(node: &Node, stats: &mut Stats) {
177177
if matches!(node.object().kind_id().into(), Java::ReturnStatement) {
178-
println!("{}", node.object().kind());
179178
stats.exit += 1;
180179
}
181180
}
@@ -333,8 +332,10 @@ mod tests {
333332
#[test]
334333
fn java_simple_function() {
335334
check_metrics!(
336-
"public int sum(int x, int y) {
335+
"class A {
336+
public int sum(int x, int y) {
337337
return x + y;
338+
}
338339
}",
339340
"foo.java",
340341
JavaParser,
@@ -344,28 +345,30 @@ mod tests {
344345
(exit_min, 0, usize),
345346
(exit_max, 1, usize)
346347
],
347-
[(exit_average, f64::NAN)] // 1 function
348+
[(exit_average, 1.0)] // 1 exit / 1 space
348349
);
349350
}
350351

351352
#[test]
352353
fn java_split_function() {
353354
check_metrics!(
354-
"public int multiply(int x, int y) {
355+
"class A {
356+
public int multiply(int x, int y) {
355357
if(x == 0 || y == 0){
356358
return 0;
357359
}
358360
return x * y;
361+
}
359362
}",
360363
"foo.java",
361364
JavaParser,
362365
nexits,
363366
[
364367
(exit_sum, 2, usize),
365368
(exit_min, 0, usize),
366-
(exit_max, 1, usize)
369+
(exit_max, 2, usize)
367370
],
368-
[(exit_average, 1.0)] // 1 function
371+
[(exit_average, 2.0)] // 2 exit / space 1
369372
);
370373
}
371374
}

0 commit comments

Comments
 (0)