Skip to content

Commit b7942fb

Browse files
style: apply clang-format
1 parent c2489eb commit b7942fb

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/main/java/com/thealgorithms/divideandconquer/Factorial.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ public static long factorial(long n) {
3737
return result;
3838
}
3939
}
40-
41-

src/test/java/com/thealgorithms/divideandconquer/FactorialTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.junit.jupiter.api.Test;
99

1010
public class FactorialTest {
11-
1211
// --------------------------------------------------------
1312
// SECTION 1: Basic Correctness Tests
1413
// --------------------------------------------------------
@@ -25,7 +24,7 @@ void testFactorialOfZero() {
2524

2625
@Test
2726
void testNegativeInputThrowsException() {
28-
assertThrows(IllegalArgumentException.class, () -> Factorial.factorial(-5));
27+
assertThrows(IllegalArgumentException.class, () -> { Factorial.factorial(-5); });
2928
}
3029

3130
// --------------------------------------------------------
@@ -47,18 +46,17 @@ void testLargeInputPerformance() {
4746
// --------------------------------------------------------
4847

4948
/**
50-
* Local copy of the original recursive implementation used only for comparing performance inside
51-
* the test.
49+
* Local copy of the original recursive implementation
50+
* used only for comparing performance inside the test.
5251
*/
5352
private long recursiveFactorial(long n) {
5453
if (n < 0) {
5554
throw new IllegalArgumentException("Negative input not allowed");
5655
}
5756
if (n == 0 || n == 1) {
5857
return 1;
59-
} else {
60-
return n * recursiveFactorial(n - 1);
6158
}
59+
return n * recursiveFactorial(n - 1);
6260
}
6361

6462
@Test
@@ -74,9 +72,7 @@ void testIterativeFasterThanRecursive() {
7472
long endIter = System.nanoTime();
7573

7674
assertEquals(recResult, iterResult);
77-
assertTrue(
78-
endIter - startIter < endRec - startRec,
79-
"Iterative version should outperform recursive version");
75+
assertTrue(endIter - startIter < endRec - startRec, "Iterative version should outperform recursive version");
8076
}
8177

8278
@Test

0 commit comments

Comments
 (0)