Karan Mirani 8 лет назад
Родитель
Сommit
93f538e91a
1 измененных файлов: 39 добавлений и 39 удалений
  1. 39
    39
      exercises/all-your-base/src/test/java/BaseConverterTest.java

+ 39
- 39
exercises/all-your-base/src/test/java/BaseConverterTest.java Просмотреть файл

14
 
14
 
15
     @Test
15
     @Test
16
     public void testSingleBitOneToDecimal() {
16
     public void testSingleBitOneToDecimal() {
17
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1});
17
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{1});
18
 
18
 
19
-        final int[] expectedDigits = new int[]{1};
20
-        final int[] actualDigits = baseConverter.convertToBase(10);
19
+         int[] expectedDigits = new int[]{1};
20
+         int[] actualDigits = baseConverter.convertToBase(10);
21
 
21
 
22
         assertArrayEquals(
22
         assertArrayEquals(
23
                 String.format(
23
                 String.format(
31
     @Ignore("Remove to run test")
31
     @Ignore("Remove to run test")
32
     @Test
32
     @Test
33
     public void testBinaryToSingleDecimal() {
33
     public void testBinaryToSingleDecimal() {
34
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1});
34
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1});
35
 
35
 
36
-        final int[] expectedDigits = new int[]{5};
37
-        final int[] actualDigits = baseConverter.convertToBase(10);
36
+         int[] expectedDigits = new int[]{5};
37
+         int[] actualDigits = baseConverter.convertToBase(10);
38
 
38
 
39
         assertArrayEquals(
39
         assertArrayEquals(
40
                 String.format(
40
                 String.format(
48
     @Ignore("Remove to run test")
48
     @Ignore("Remove to run test")
49
     @Test
49
     @Test
50
     public void testSingleDecimalToBinary() {
50
     public void testSingleDecimalToBinary() {
51
-        final BaseConverter baseConverter = new BaseConverter(10, new int[]{5});
51
+         BaseConverter baseConverter = new BaseConverter(10, new int[]{5});
52
 
52
 
53
-        final int[] expectedDigits = new int[]{1, 0, 1};
54
-        final int[] actualDigits = baseConverter.convertToBase(2);
53
+         int[] expectedDigits = new int[]{1, 0, 1};
54
+         int[] actualDigits = baseConverter.convertToBase(2);
55
 
55
 
56
         assertArrayEquals(
56
         assertArrayEquals(
57
                 String.format(
57
                 String.format(
65
     @Ignore("Remove to run test")
65
     @Ignore("Remove to run test")
66
     @Test
66
     @Test
67
     public void testBinaryToMultipleDecimal() {
67
     public void testBinaryToMultipleDecimal() {
68
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
68
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
69
 
69
 
70
-        final int[] expectedDigits = new int[]{4, 2};
71
-        final int[] actualDigits = baseConverter.convertToBase(10);
70
+         int[] expectedDigits = new int[]{4, 2};
71
+         int[] actualDigits = baseConverter.convertToBase(10);
72
 
72
 
73
         assertArrayEquals(
73
         assertArrayEquals(
74
                 String.format(
74
                 String.format(
82
     @Ignore("Remove to run test")
82
     @Ignore("Remove to run test")
83
     @Test
83
     @Test
84
     public void testDecimalToBinary() {
84
     public void testDecimalToBinary() {
85
-        final BaseConverter baseConverter = new BaseConverter(10, new int[]{4, 2});
85
+         BaseConverter baseConverter = new BaseConverter(10, new int[]{4, 2});
86
 
86
 
87
-        final int[] expectedDigits = new int[]{1, 0, 1, 0, 1, 0};
88
-        final int[] actualDigits = baseConverter.convertToBase(2);
87
+         int[] expectedDigits = new int[]{1, 0, 1, 0, 1, 0};
88
+         int[] actualDigits = baseConverter.convertToBase(2);
89
 
89
 
90
         assertArrayEquals(
90
         assertArrayEquals(
91
                 String.format(
91
                 String.format(
99
     @Ignore("Remove to run test")
99
     @Ignore("Remove to run test")
100
     @Test
100
     @Test
101
     public void testTrinaryToHexadecimal() {
101
     public void testTrinaryToHexadecimal() {
102
-        final BaseConverter baseConverter = new BaseConverter(3, new int[]{1, 1, 2, 0});
102
+         BaseConverter baseConverter = new BaseConverter(3, new int[]{1, 1, 2, 0});
103
 
103
 
104
-        final int[] expectedDigits = new int[]{2, 10};
105
-        final int[] actualDigits = baseConverter.convertToBase(16);
104
+         int[] expectedDigits = new int[]{2, 10};
105
+         int[] actualDigits = baseConverter.convertToBase(16);
106
 
106
 
107
         assertArrayEquals(
107
         assertArrayEquals(
108
                 String.format(
108
                 String.format(
116
     @Ignore("Remove to run test")
116
     @Ignore("Remove to run test")
117
     @Test
117
     @Test
118
     public void testHexadecimalToTrinary() {
118
     public void testHexadecimalToTrinary() {
119
-        final BaseConverter baseConverter = new BaseConverter(16, new int[]{2, 10});
119
+         BaseConverter baseConverter = new BaseConverter(16, new int[]{2, 10});
120
 
120
 
121
-        final int[] expectedDigits = new int[]{1, 1, 2, 0};
122
-        final int[] actualDigits = baseConverter.convertToBase(3);
121
+         int[] expectedDigits = new int[]{1, 1, 2, 0};
122
+         int[] actualDigits = baseConverter.convertToBase(3);
123
 
123
 
124
         assertArrayEquals(
124
         assertArrayEquals(
125
                 String.format(
125
                 String.format(
133
     @Ignore("Remove to run test")
133
     @Ignore("Remove to run test")
134
     @Test
134
     @Test
135
     public void test15BitInteger() {
135
     public void test15BitInteger() {
136
-        final BaseConverter baseConverter = new BaseConverter(97, new int[]{3, 46, 60});
136
+         BaseConverter baseConverter = new BaseConverter(97, new int[]{3, 46, 60});
137
 
137
 
138
-        final int[] expectedDigits = new int[]{6, 10, 45};
139
-        final int[] actualDigits = baseConverter.convertToBase(73);
138
+         int[] expectedDigits = new int[]{6, 10, 45};
139
+         int[] actualDigits = baseConverter.convertToBase(73);
140
 
140
 
141
         assertArrayEquals(
141
         assertArrayEquals(
142
                 String.format(
142
                 String.format(
150
     @Ignore("Remove to run test")
150
     @Ignore("Remove to run test")
151
     @Test
151
     @Test
152
     public void testEmptyDigits() {
152
     public void testEmptyDigits() {
153
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{});
153
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{});
154
 
154
 
155
-        final int[] expectedDigits = new int[]{0};
156
-        final int[] actualDigits = baseConverter.convertToBase(10);
155
+         int[] expectedDigits = new int[]{0};
156
+         int[] actualDigits = baseConverter.convertToBase(10);
157
 
157
 
158
         assertArrayEquals(
158
         assertArrayEquals(
159
             String.format(
159
             String.format(
167
     @Ignore("Remove to run test")
167
     @Ignore("Remove to run test")
168
     @Test
168
     @Test
169
     public void testSingleZero() {
169
     public void testSingleZero() {
170
-        final BaseConverter baseConverter = new BaseConverter(10, new int[]{0});
170
+         BaseConverter baseConverter = new BaseConverter(10, new int[]{0});
171
 
171
 
172
-        final int[] expectedDigits = new int[]{0};
173
-        final int[] actualDigits = baseConverter.convertToBase(2);
172
+         int[] expectedDigits = new int[]{0};
173
+         int[] actualDigits = baseConverter.convertToBase(2);
174
 
174
 
175
         assertArrayEquals(
175
         assertArrayEquals(
176
                 String.format(
176
                 String.format(
184
     @Ignore("Remove to run test")
184
     @Ignore("Remove to run test")
185
     @Test
185
     @Test
186
     public void testMultipleZeros() {
186
     public void testMultipleZeros() {
187
-        final BaseConverter baseConverter = new BaseConverter(10, new int[]{0, 0, 0});
187
+         BaseConverter baseConverter = new BaseConverter(10, new int[]{0, 0, 0});
188
 
188
 
189
-        final int[] expectedDigits = new int[]{0};
190
-        final int[] actualDigits = baseConverter.convertToBase(2);
189
+         int[] expectedDigits = new int[]{0};
190
+         int[] actualDigits = baseConverter.convertToBase(2);
191
 
191
 
192
         assertArrayEquals(
192
         assertArrayEquals(
193
             String.format(
193
             String.format(
201
     @Ignore("Remove to run test")
201
     @Ignore("Remove to run test")
202
     @Test
202
     @Test
203
     public void testLeadingZeros() {
203
     public void testLeadingZeros() {
204
-        final BaseConverter baseConverter = new BaseConverter(7, new int[]{0, 6, 0});
204
+         BaseConverter baseConverter = new BaseConverter(7, new int[]{0, 6, 0});
205
 
205
 
206
-        final int[] expectedDigits = new int[]{4, 2};
207
-        final int[] actualDigits = baseConverter.convertToBase(10);
206
+         int[] expectedDigits = new int[]{4, 2};
207
+         int[] actualDigits = baseConverter.convertToBase(10);
208
 
208
 
209
         assertArrayEquals(
209
         assertArrayEquals(
210
             String.format(
210
             String.format(
263
     @Ignore("Remove to run test")
263
     @Ignore("Remove to run test")
264
     @Test
264
     @Test
265
     public void testSecondBaseIsOne() {
265
     public void testSecondBaseIsOne() {
266
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
266
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
267
 
267
 
268
         expectedException.expect(IllegalArgumentException.class);
268
         expectedException.expect(IllegalArgumentException.class);
269
         expectedException.expectMessage("Bases must be at least 2.");
269
         expectedException.expectMessage("Bases must be at least 2.");
274
     @Ignore("Remove to run test")
274
     @Ignore("Remove to run test")
275
     @Test
275
     @Test
276
     public void testSecondBaseIsZero() {
276
     public void testSecondBaseIsZero() {
277
-        final BaseConverter baseConverter = new BaseConverter(10, new int[]{7});
277
+         BaseConverter baseConverter = new BaseConverter(10, new int[]{7});
278
 
278
 
279
         expectedException.expect(IllegalArgumentException.class);
279
         expectedException.expect(IllegalArgumentException.class);
280
         expectedException.expectMessage("Bases must be at least 2.");
280
         expectedException.expectMessage("Bases must be at least 2.");
285
     @Ignore("Remove to run test")
285
     @Ignore("Remove to run test")
286
     @Test
286
     @Test
287
     public void testSecondBaseIsNegative() {
287
     public void testSecondBaseIsNegative() {
288
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1});
288
+         BaseConverter baseConverter = new BaseConverter(2, new int[]{1});
289
 
289
 
290
         expectedException.expect(IllegalArgumentException.class);
290
         expectedException.expect(IllegalArgumentException.class);
291
         expectedException.expectMessage("Bases must be at least 2.");
291
         expectedException.expectMessage("Bases must be at least 2.");