Add tests for sum of digits (#3083)
This commit is contained in:
parent
8982692ca6
commit
ba3c0319ed
25
src/test/java/com/thealgorithms/maths/SumOfDigitsTest.java
Normal file
25
src/test/java/com/thealgorithms/maths/SumOfDigitsTest.java
Normal file
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user