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.99 KB
/
BinaryTest.java
File metadata and controls
114 lines (95 loc) · 2.99 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.assertj.core.api.Assertions.assertThat;
public class BinaryTest {
private Binary binary;
@Test
public void testBinary0IsDecimal0() {
binary = new Binary("0");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testBinary1IsDecimal1() {
binary = new Binary("1");
assertThat(binary.getDecimal()).isEqualTo(1);
}
@Ignore("Remove to run test")
@Test
public void testBinary10IsDecimal2() {
binary = new Binary("10");
assertThat(binary.getDecimal()).isEqualTo(2);
}
@Ignore("Remove to run test")
@Test
public void testBinary11IsDecimal3() {
binary = new Binary("11");
assertThat(binary.getDecimal()).isEqualTo(3);
}
@Ignore("Remove to run test")
@Test
public void testBinary100IsDecimal4() {
binary = new Binary("100");
assertThat(binary.getDecimal()).isEqualTo(4);
}
@Ignore("Remove to run test")
@Test
public void testBinary1001IsDecimal9() {
binary = new Binary("1001");
assertThat(binary.getDecimal()).isEqualTo(9);
}
@Ignore("Remove to run test")
@Test
public void testBinary11010IsDecimal26() {
binary = new Binary("11010");
assertThat(binary.getDecimal()).isEqualTo(26);
}
@Ignore("Remove to run test")
@Test
public void testBinary10001101000IsDecimal1128() {
binary = new Binary("10001101000");
assertThat(binary.getDecimal()).isEqualTo(1128);
}
@Ignore("Remove to run test")
@Test
public void testBinaryIgnoresLeadingZeros() {
binary = new Binary("000011111");
assertThat(binary.getDecimal()).isEqualTo(31);
}
@Ignore("Remove to run test")
@Test
public void test2NotValidBinaryDigit() {
binary = new Binary("2");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testNumberContainingNonBinaryDigitInvalid() {
binary = new Binary("01201");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testNumberWithTrailingNonBinaryCharactersInvalid() {
binary = new Binary("10nope");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testNumberWithLeadingNonBinaryCharactersInvalid() {
binary = new Binary("nope10");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testNumberWithInternalNonBinaryCharactersInvalid() {
binary = new Binary("10nope10");
assertThat(binary.getDecimal()).isEqualTo(0);
}
@Ignore("Remove to run test")
@Test
public void testNumberAndWordWhitespaceSeparatedInvalid() {
binary = new Binary("001 nope");
assertThat(binary.getDecimal()).isEqualTo(0);
}
}