forked from exercism/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryTest.java
More file actions
114 lines (95 loc) · 2.86 KB
/
BinaryTest.java
File metadata and controls
114 lines (95 loc) · 2.86 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import org.junit.Test;
import org.junit.Ignore;
import static org.junit.Assert.assertEquals;
public class BinaryTest {
private Binary binary;
@Test
public void testBinary0IsDecimal0() {
binary = new Binary("0");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary1IsDecimal1() {
binary = new Binary("1");
assertEquals(1, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary10IsDecimal2() {
binary = new Binary("10");
assertEquals(2, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary11IsDecimal3() {
binary = new Binary("11");
assertEquals(3, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary100IsDecimal4() {
binary = new Binary("100");
assertEquals(4, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary1001IsDecimal9() {
binary = new Binary("1001");
assertEquals(9, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary11010IsDecimal26() {
binary = new Binary("11010");
assertEquals(26, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinary10001101000IsDecimal1128() {
binary = new Binary("10001101000");
assertEquals(1128, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testBinaryIgnoresLeadingZeros() {
binary = new Binary("000011111");
assertEquals(31, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void test2NotValidBinaryDigit() {
binary = new Binary("2");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testNumberContainingNonBinaryDigitInvalid() {
binary = new Binary("01201");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testNumberWithTrailingNonBinaryCharactersInvalid() {
binary = new Binary("10nope");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testNumberWithLeadingNonBinaryCharactersInvalid() {
binary = new Binary("nope10");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testNumberWithInternalNonBinaryCharactersInvalid() {
binary = new Binary("10nope10");
assertEquals(0, binary.getDecimal());
}
@Ignore("Remove to run test")
@Test
public void testNumberAndWordWhitespaceSeparatedInvalid() {
binary = new Binary("001 nope");
assertEquals(0, binary.getDecimal());
}
}