Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.thealgorithms.maths; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
|
||
|
||
public class FactorialTest { | ||
|
||
@Test | ||
public void test() { | ||
Factorial fact = new Factorial(); | ||
assertEquals(120,fact.factorial(5)); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/test/java/com/thealgorithms/maths/SumOfDigitsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.thealgorithms.maths; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* @author SirFixalot16 | ||
* @since 01/06/22 | ||
*/ | ||
public class SumOfDigitsTest { | ||
@Test | ||
void isSumOf2Digits() { | ||
SumOfDigits sum = new SumOfDigits(); | ||
assertEquals(11, sum.sumOfDigits(56)); | ||
} | ||
void isSumOf3Digits() { | ||
SumOfDigits sum = new SumOfDigits(); | ||
assertEquals(12, sum.sumOfDigits(192)); | ||
} | ||
void isSumOf4Digits() { | ||
SumOfDigits sum = new SumOfDigits(); | ||
assertEquals(25, sum.sumOfDigits(8962)); | ||
} | ||
} |