Add tests for sum of digits (#3083)

This commit is contained in:
Quốc Thái Vũ 2022-06-09 13:50:16 +07:00 committed by GitHub
parent 8982692ca6
commit ba3c0319ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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));
}
}