forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHarshadNumberTest.java
More file actions
25 lines (19 loc) · 810 Bytes
/
HarshadNumberTest.java
File metadata and controls
25 lines (19 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.thealgorithms.maths;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
public class HarshadNumberTest {
@Test
public void harshadNumber() {
assertTrue(HarshadNumber.isHarshad(18));
assertFalse(HarshadNumber.isHarshad(-18));
assertFalse(HarshadNumber.isHarshad(19));
assertTrue(HarshadNumber.isHarshad(999999999));
assertFalse(HarshadNumber.isHarshad(0));
assertTrue(HarshadNumber.isHarshad("18"));
assertFalse(HarshadNumber.isHarshad("-18"));
assertFalse(HarshadNumber.isHarshad("19"));
assertTrue(HarshadNumber.isHarshad("999999999"));
assertTrue(HarshadNumber.isHarshad("99999999999100"));
}
}