forked from exercism/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOctalTest.java
More file actions
49 lines (40 loc) · 1.14 KB
/
OctalTest.java
File metadata and controls
49 lines (40 loc) · 1.14 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class OctalTest {
private String input;
private int expectedOutput;
@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"1", 1},
{"10", 8},
{"17", 15},
{"11", 9},
{"130", 88},
{"2047", 1063},
{"7777", 4095},
{"1234567", 342391},
{"carrot", 0},
{"8", 0},
{"9", 0},
{"6789", 0},
{"abc1z", 0},
{"011", 9}
});
}
public OctalTest(String input, int expectedOutput) {
this.input = input;
this.expectedOutput = expectedOutput;
}
@Test
public void test() {
Octal octal = new Octal(input);
assertEquals(expectedOutput, octal.getDecimal());
}
}