Skip to content

Commit 35be17e

Browse files
committed
Fix code formatting according to Clang-format
1 parent f64a46a commit 35be17e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ private Factorial() {
2020
* @return factorial of n
2121
* @throws IllegalArgumentException if n is negative
2222
*/
23-
24-
public static long factorial(int n) {
23+
24+
public static long factorial(int n) {
2525
if (n < 0) {
2626
throw new IllegalArgumentException("Factorial is not defined for negative numbers.");
2727
}
28+
2829
if (n == 0 || n == 1) {
2930
return 1;
3031
}
3132
return n * factorial(n - 1);
3233
}
3334
}
34-

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,30 @@
66
import org.junit.jupiter.api.Test;
77

88
public class FactorialTest {
9-
@Test
10-
public void testFactorialOfZero() {
11-
assertEquals(1, Factorial.factorial(0));
12-
}
13-
14-
@Test
15-
public void testFactorialOfOne() {
16-
assertEquals(1, Factorial.factorial(1));
9+
@Test
10+
public void testFactorialOfZero() {
11+
assertEquals(1, Factorial.factorial(0));
12+
}
13+
14+
@Test
15+
public void testFactorialOfOne() {
16+
assertEquals(1, Factorial.factorial(1));
1717
}
18-
18+
1919
@Test
2020
public void testFactorialOfPositiveNumbers() {
2121
assertEquals(120, Factorial.factorial(5));
2222
assertEquals(720, Factorial.factorial(6));
2323
assertEquals(5040, Factorial.factorial(7));
2424
}
25-
25+
2626
@Test
2727
public void testFactorialOfTen() {
2828
assertEquals(3628800, Factorial.factorial(10));
2929
}
30-
30+
3131
@Test
3232
public void testNegativeNumberThrowsException() {
3333
assertThrows(IllegalArgumentException.class, () -> Factorial.factorial(-1));
3434
}
3535
}
36-

0 commit comments

Comments
 (0)