forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigitTest.java
More file actions
30 lines (25 loc) · 729 Bytes
/
Copy pathDigitTest.java
File metadata and controls
30 lines (25 loc) · 729 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
26
27
28
29
30
package fj;
import fj.data.Option;
import org.junit.Test;
import static fj.data.Array.range;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class DigitTest {
@Test
public void testInteger() {
for (Integer i: range(0, 10)) {
assertThat(Digit.fromLong(i).toLong(), is(i.longValue()));
}
}
@Test
public void testChar() {
for (Integer i: range(0, 10)) {
Character c = Character.forDigit(i, 10);
assertThat(Digit.fromChar(c).some().toChar(), is(c));
}
}
@Test
public void testCharNone() {
assertThat(Digit.fromChar('x'), is(Option.none()));
}
}