소스 검색

Normalized EOF's

Logan Stucki 9 년 전
부모
커밋
9c1b2ea81d

+ 359
- 359
config.json 파일 보기

1
-{
2
-  "slug": "java",
3
-  "language": "Java",
4
-  "repository": "https://github.com/exercism/xjava",
5
-  "active": true,
6
-
7
-  "exercises": [
8
-    {
9
-      "slug": "hello-world",
10
-      "difficulty": 1,
11
-      "topics": []
12
-    },
13
-    {
14
-      "slug": "rna-transcription",
15
-      "difficulty": 2,
16
-      "topics": []
17
-    },
18
-    {
19
-      "slug": "pangram",
20
-      "difficulty": 3,
21
-      "topics": []
22
-    },
23
-    {
24
-      "slug": "hamming",
25
-      "difficulty": 3,
26
-      "topics": []
27
-    },
28
-    {
29
-      "slug": "gigasecond",
30
-      "difficulty": 3,
31
-      "topics": []
32
-    },
33
-    {
34
-      "slug": "space-age",
35
-      "difficulty": 3,
36
-      "topics": []
37
-    },
38
-    {
39
-      "slug": "acronym",
40
-      "difficulty": 3,
41
-      "topics": []
42
-    },
43
-    {
44
-      "slug": "scrabble-score",
45
-      "difficulty": 3,
46
-      "topics": []
47
-    },
48
-    {
49
-      "slug": "raindrops",
50
-      "difficulty": 3,
51
-      "topics": []
52
-    },
53
-    {
54
-      "slug": "difference-of-squares",
55
-      "difficulty": 3,
56
-      "topics": []
57
-    },
58
-    {
59
-      "slug": "secret-handshake",
60
-      "difficulty": 3,
61
-      "topics": []
62
-    },
63
-    {
64
-      "slug": "sum-of-multiples",
65
-      "difficulty": 4,
66
-      "topics": []
67
-    },
68
-    {
69
-      "slug": "luhn",
70
-      "difficulty": 4,
71
-      "topics": []
72
-    },
73
-    {
74
-      "slug": "matrix",
75
-      "difficulty": 4,
76
-      "topics": []
77
-    },
78
-    {
79
-      "slug": "triangle",
80
-      "difficulty": 4,
81
-      "topics": []
82
-    },
83
-    {
84
-      "slug": "largest-series-product",
85
-      "difficulty": 4,
86
-      "topics": []
87
-    },
88
-    {
89
-      "slug": "sieve",
90
-      "difficulty": 4,
91
-      "topics": []
92
-    },
93
-    {
94
-      "slug": "twelve-days",
95
-      "difficulty": 4,
96
-      "topics": []
97
-    },
98
-    {
99
-      "slug": "nth-prime",
100
-      "difficulty": 4,
101
-      "topics": []
102
-    },
103
-    {
104
-      "slug": "diamond",
105
-      "difficulty": 4,
106
-      "topics": []
107
-    },
108
-    {
109
-      "slug": "isogram",
110
-      "difficulty": 4,
111
-      "topics": []
112
-    },
113
-    {
114
-      "slug": "flatten-array",
115
-      "difficulty": 5,
116
-      "topics": []
117
-    },
118
-    {
119
-      "slug": "pig-latin",
120
-      "difficulty": 5,
121
-      "topics": []
122
-    },
123
-    {
124
-      "slug": "phone-number",
125
-      "difficulty": 5,
126
-      "topics": []
127
-    },
128
-    {
129
-      "slug": "accumulate",
130
-      "difficulty": 5,
131
-      "topics": []
132
-    },
133
-    {
134
-      "slug": "nucleotide-count",
135
-      "difficulty": 5,
136
-      "topics": []
137
-    },
138
-    {
139
-      "slug": "word-count",
140
-      "difficulty": 5,
141
-      "topics": []
142
-    },
143
-    {
144
-      "slug": "robot-name",
145
-      "difficulty": 5,
146
-      "topics": []
147
-    },
148
-    {
149
-      "slug": "prime-factors",
150
-      "difficulty": 5,
151
-      "topics": []
152
-    },
153
-    {
154
-      "slug": "allergies",
155
-      "difficulty": 5,
156
-      "topics": []
157
-    },
158
-    {
159
-      "slug": "bob",
160
-      "difficulty": 5,
161
-      "topics": []
162
-    },
163
-    {
164
-      "slug": "pascals-triangle",
165
-      "difficulty": 5,
166
-      "topics": []
167
-    },
168
-    {
169
-      "slug": "bracket-push",
170
-      "difficulty": 5,
171
-      "topics": []
172
-    },
173
-    {
174
-      "slug": "series",
175
-      "difficulty": 5,
176
-      "topics": []
177
-    },
178
-    {
179
-      "slug": "atbash-cipher",
180
-      "difficulty": 5,
181
-      "topics": []
182
-    },
183
-    {
184
-      "slug": "strain",
185
-      "difficulty": 5,
186
-      "topics": []
187
-    },
188
-    {
189
-      "slug": "roman-numerals",
190
-      "difficulty": 6,
191
-      "topics": []
192
-    },
193
-    {
194
-      "slug": "beer-song",
195
-      "difficulty": 6,
196
-      "topics": []
197
-    },
198
-    {
199
-      "slug": "queen-attack",
200
-      "difficulty": 6,
201
-      "topics": []
202
-    },
203
-    {
204
-      "slug": "etl",
205
-      "difficulty": 6,
206
-      "topics": []
207
-    },
208
-    {
209
-      "slug": "linked-list",
210
-      "difficulty": 6,
211
-      "topics": []
212
-    },
213
-    {
214
-      "slug": "grade-school",
215
-      "difficulty": 6,
216
-      "topics": []
217
-    },
218
-    {
219
-      "slug": "robot-simulator",
220
-      "difficulty": 6,
221
-      "topics": []
222
-    },
223
-    {
224
-      "slug": "binary-search",
225
-      "difficulty": 6,
226
-      "topics": []
227
-    },
228
-    {
229
-      "slug": "minesweeper",
230
-      "difficulty": 6,
231
-      "topics": []
232
-    },
233
-    {
234
-      "slug": "wordy",
235
-      "difficulty": 6,
236
-      "topics": []
237
-    },
238
-    {
239
-      "slug": "all-your-base",
240
-      "difficulty": 6,
241
-      "topics": []
242
-    },
243
-    {
244
-      "slug": "anagram",
245
-      "difficulty": 7,
246
-      "topics": []
247
-    },
248
-    {
249
-      "slug": "sublist",
250
-      "difficulty": 7,
251
-      "topics": []
252
-    },
253
-    {
254
-      "slug": "simple-linked-list",
255
-      "difficulty": 7,
256
-      "topics": []
257
-    },
258
-    {
259
-      "slug": "binary-search-tree",
260
-      "difficulty": 7,
261
-      "topics": []
262
-    },
263
-    {
264
-      "slug": "rectangles",
265
-      "difficulty": 7,
266
-      "topics": []
267
-    },
268
-    {
269
-      "slug": "meetup",
270
-      "difficulty": 7,
271
-      "topics": []
272
-    },
273
-    {
274
-      "slug": "crypto-square",
275
-      "difficulty": 7,
276
-      "topics": []
277
-    },
278
-    {
279
-      "slug": "simple-cipher",
280
-      "difficulty": 8,
281
-      "topics": []
282
-    },
283
-    {
284
-      "slug": "palindrome-products",
285
-      "difficulty": 8,
286
-      "topics": []
287
-    },
288
-    {
289
-      "slug": "pythagorean-triplet",
290
-      "difficulty": 9,
291
-      "topics": []
292
-    },
293
-    {
294
-      "slug": "custom-set",
295
-      "difficulty": 10,
296
-      "topics": []
297
-    },
298
-    {
299
-      "slug": "clock",
300
-      "difficulty": 1,
301
-      "topics": []
302
-    },
303
-    {
304
-      "slug": "perfect-numbers",
305
-      "difficulty": 1,
306
-      "topics": []
307
-    },
308
-    {
309
-      "slug": "change",
310
-      "difficulty": 1,
311
-      "topics": []
312
-    },
313
-    {
314
-      "slug": "list-ops",
315
-      "difficulty": 1,
316
-      "topics": []
317
-    },
318
-    {
319
-      "slug": "ocr-numbers",
320
-      "difficulty": 1,
321
-      "topics": []
322
-    },
323
-    {
324
-      "slug": "book-store",
325
-      "difficulty": 1,
326
-      "topics": []
327
-    },
328
-    {
329
-      "slug": "saddle-points",
330
-      "difficulty": 1,
331
-      "topics": []
332
-    },
333
-    {
334
-      "slug": "run-length-encoding",
335
-      "difficulty": 1,
336
-      "topics": []
337
-    }
338
-  ],
339
-  "deprecated": [
340
-    "binary",
341
-    "hexadecimal",
342
-    "octal",
343
-    "trinary"
344
-  ],
345
-  "ignored": [
346
-    "_template",
347
-    ".gradle",
348
-    "build",
349
-    "docs",
350
-    "gradle",
351
-    "scripts"
352
-  ],
353
-  "foregone": [
354
-    "leap",
355
-    "grains",
356
-    "say"
357
-  ]
358
-}
359
-
1
+{
2
+  "slug": "java",
3
+  "language": "Java",
4
+  "repository": "https://github.com/exercism/xjava",
5
+  "active": true,
6
+
7
+  "exercises": [
8
+    {
9
+      "slug": "hello-world",
10
+      "difficulty": 1,
11
+      "topics": []
12
+    },
13
+    {
14
+      "slug": "rna-transcription",
15
+      "difficulty": 2,
16
+      "topics": []
17
+    },
18
+    {
19
+      "slug": "pangram",
20
+      "difficulty": 3,
21
+      "topics": []
22
+    },
23
+    {
24
+      "slug": "hamming",
25
+      "difficulty": 3,
26
+      "topics": []
27
+    },
28
+    {
29
+      "slug": "gigasecond",
30
+      "difficulty": 3,
31
+      "topics": []
32
+    },
33
+    {
34
+      "slug": "space-age",
35
+      "difficulty": 3,
36
+      "topics": []
37
+    },
38
+    {
39
+      "slug": "acronym",
40
+      "difficulty": 3,
41
+      "topics": []
42
+    },
43
+    {
44
+      "slug": "scrabble-score",
45
+      "difficulty": 3,
46
+      "topics": []
47
+    },
48
+    {
49
+      "slug": "raindrops",
50
+      "difficulty": 3,
51
+      "topics": []
52
+    },
53
+    {
54
+      "slug": "difference-of-squares",
55
+      "difficulty": 3,
56
+      "topics": []
57
+    },
58
+    {
59
+      "slug": "secret-handshake",
60
+      "difficulty": 3,
61
+      "topics": []
62
+    },
63
+    {
64
+      "slug": "sum-of-multiples",
65
+      "difficulty": 4,
66
+      "topics": []
67
+    },
68
+    {
69
+      "slug": "luhn",
70
+      "difficulty": 4,
71
+      "topics": []
72
+    },
73
+    {
74
+      "slug": "matrix",
75
+      "difficulty": 4,
76
+      "topics": []
77
+    },
78
+    {
79
+      "slug": "triangle",
80
+      "difficulty": 4,
81
+      "topics": []
82
+    },
83
+    {
84
+      "slug": "largest-series-product",
85
+      "difficulty": 4,
86
+      "topics": []
87
+    },
88
+    {
89
+      "slug": "sieve",
90
+      "difficulty": 4,
91
+      "topics": []
92
+    },
93
+    {
94
+      "slug": "twelve-days",
95
+      "difficulty": 4,
96
+      "topics": []
97
+    },
98
+    {
99
+      "slug": "nth-prime",
100
+      "difficulty": 4,
101
+      "topics": []
102
+    },
103
+    {
104
+      "slug": "diamond",
105
+      "difficulty": 4,
106
+      "topics": []
107
+    },
108
+    {
109
+      "slug": "isogram",
110
+      "difficulty": 4,
111
+      "topics": []
112
+    },
113
+    {
114
+      "slug": "flatten-array",
115
+      "difficulty": 5,
116
+      "topics": []
117
+    },
118
+    {
119
+      "slug": "pig-latin",
120
+      "difficulty": 5,
121
+      "topics": []
122
+    },
123
+    {
124
+      "slug": "phone-number",
125
+      "difficulty": 5,
126
+      "topics": []
127
+    },
128
+    {
129
+      "slug": "accumulate",
130
+      "difficulty": 5,
131
+      "topics": []
132
+    },
133
+    {
134
+      "slug": "nucleotide-count",
135
+      "difficulty": 5,
136
+      "topics": []
137
+    },
138
+    {
139
+      "slug": "word-count",
140
+      "difficulty": 5,
141
+      "topics": []
142
+    },
143
+    {
144
+      "slug": "robot-name",
145
+      "difficulty": 5,
146
+      "topics": []
147
+    },
148
+    {
149
+      "slug": "prime-factors",
150
+      "difficulty": 5,
151
+      "topics": []
152
+    },
153
+    {
154
+      "slug": "allergies",
155
+      "difficulty": 5,
156
+      "topics": []
157
+    },
158
+    {
159
+      "slug": "bob",
160
+      "difficulty": 5,
161
+      "topics": []
162
+    },
163
+    {
164
+      "slug": "pascals-triangle",
165
+      "difficulty": 5,
166
+      "topics": []
167
+    },
168
+    {
169
+      "slug": "bracket-push",
170
+      "difficulty": 5,
171
+      "topics": []
172
+    },
173
+    {
174
+      "slug": "series",
175
+      "difficulty": 5,
176
+      "topics": []
177
+    },
178
+    {
179
+      "slug": "atbash-cipher",
180
+      "difficulty": 5,
181
+      "topics": []
182
+    },
183
+    {
184
+      "slug": "strain",
185
+      "difficulty": 5,
186
+      "topics": []
187
+    },
188
+    {
189
+      "slug": "roman-numerals",
190
+      "difficulty": 6,
191
+      "topics": []
192
+    },
193
+    {
194
+      "slug": "beer-song",
195
+      "difficulty": 6,
196
+      "topics": []
197
+    },
198
+    {
199
+      "slug": "queen-attack",
200
+      "difficulty": 6,
201
+      "topics": []
202
+    },
203
+    {
204
+      "slug": "etl",
205
+      "difficulty": 6,
206
+      "topics": []
207
+    },
208
+    {
209
+      "slug": "linked-list",
210
+      "difficulty": 6,
211
+      "topics": []
212
+    },
213
+    {
214
+      "slug": "grade-school",
215
+      "difficulty": 6,
216
+      "topics": []
217
+    },
218
+    {
219
+      "slug": "robot-simulator",
220
+      "difficulty": 6,
221
+      "topics": []
222
+    },
223
+    {
224
+      "slug": "binary-search",
225
+      "difficulty": 6,
226
+      "topics": []
227
+    },
228
+    {
229
+      "slug": "minesweeper",
230
+      "difficulty": 6,
231
+      "topics": []
232
+    },
233
+    {
234
+      "slug": "wordy",
235
+      "difficulty": 6,
236
+      "topics": []
237
+    },
238
+    {
239
+      "slug": "all-your-base",
240
+      "difficulty": 6,
241
+      "topics": []
242
+    },
243
+    {
244
+      "slug": "anagram",
245
+      "difficulty": 7,
246
+      "topics": []
247
+    },
248
+    {
249
+      "slug": "sublist",
250
+      "difficulty": 7,
251
+      "topics": []
252
+    },
253
+    {
254
+      "slug": "simple-linked-list",
255
+      "difficulty": 7,
256
+      "topics": []
257
+    },
258
+    {
259
+      "slug": "binary-search-tree",
260
+      "difficulty": 7,
261
+      "topics": []
262
+    },
263
+    {
264
+      "slug": "rectangles",
265
+      "difficulty": 7,
266
+      "topics": []
267
+    },
268
+    {
269
+      "slug": "meetup",
270
+      "difficulty": 7,
271
+      "topics": []
272
+    },
273
+    {
274
+      "slug": "crypto-square",
275
+      "difficulty": 7,
276
+      "topics": []
277
+    },
278
+    {
279
+      "slug": "simple-cipher",
280
+      "difficulty": 8,
281
+      "topics": []
282
+    },
283
+    {
284
+      "slug": "palindrome-products",
285
+      "difficulty": 8,
286
+      "topics": []
287
+    },
288
+    {
289
+      "slug": "pythagorean-triplet",
290
+      "difficulty": 9,
291
+      "topics": []
292
+    },
293
+    {
294
+      "slug": "custom-set",
295
+      "difficulty": 10,
296
+      "topics": []
297
+    },
298
+    {
299
+      "slug": "clock",
300
+      "difficulty": 1,
301
+      "topics": []
302
+    },
303
+    {
304
+      "slug": "perfect-numbers",
305
+      "difficulty": 1,
306
+      "topics": []
307
+    },
308
+    {
309
+      "slug": "change",
310
+      "difficulty": 1,
311
+      "topics": []
312
+    },
313
+    {
314
+      "slug": "list-ops",
315
+      "difficulty": 1,
316
+      "topics": []
317
+    },
318
+    {
319
+      "slug": "ocr-numbers",
320
+      "difficulty": 1,
321
+      "topics": []
322
+    },
323
+    {
324
+      "slug": "book-store",
325
+      "difficulty": 1,
326
+      "topics": []
327
+    },
328
+    {
329
+      "slug": "saddle-points",
330
+      "difficulty": 1,
331
+      "topics": []
332
+    },
333
+    {
334
+      "slug": "run-length-encoding",
335
+      "difficulty": 1,
336
+      "topics": []
337
+    }
338
+  ],
339
+  "deprecated": [
340
+    "binary",
341
+    "hexadecimal",
342
+    "octal",
343
+    "trinary"
344
+  ],
345
+  "ignored": [
346
+    "_template",
347
+    ".gradle",
348
+    "build",
349
+    "docs",
350
+    "gradle",
351
+    "scripts"
352
+  ],
353
+  "foregone": [
354
+    "leap",
355
+    "grains",
356
+    "say"
357
+  ]
358
+}
359
+

+ 17
- 17
exercises/run-length-encoding/build.gradle 파일 보기

1
-apply plugin: "java"
2
-apply plugin: "eclipse"
3
-apply plugin: "idea"
4
-
5
-repositories {
6
-    mavenCentral()
7
-}
8
-
9
-dependencies {
10
-    testCompile "junit:junit:4.12"
11
-}
12
-test {
13
-    testLogging {
14
-        exceptionFormat = 'full'
15
-        events = ["passed", "failed", "skipped"]
16
-    }
17
-}
1
+apply plugin: "java"
2
+apply plugin: "eclipse"
3
+apply plugin: "idea"
4
+
5
+repositories {
6
+    mavenCentral()
7
+}
8
+
9
+dependencies {
10
+    testCompile "junit:junit:4.12"
11
+}
12
+test {
13
+    testLogging {
14
+        exceptionFormat = 'full'
15
+        events = ["passed", "failed", "skipped"]
16
+    }
17
+}

+ 66
- 66
exercises/run-length-encoding/src/example/java/RunLengthEncoding.java 파일 보기

1
-import java.util.regex.Matcher;
2
-import java.util.regex.Pattern;
3
-
4
-public class RunLengthEncoding {
5
-    public String encode(String data) {
6
-
7
-        StringBuilder encodedDataBuilder = new StringBuilder();
8
-
9
-        if (data.length() == 0) {
10
-            return data;
11
-        }
12
-
13
-        int previousCharCount = 1;
14
-        char previousChar = data.charAt(0);
15
-
16
-        for (int i = 1; i < data.length(); i++) {
17
-            char currentChar = data.charAt(i);
18
-
19
-            if (previousChar == currentChar) {
20
-                previousCharCount++;
21
-            }
22
-
23
-            if (previousChar != currentChar || i == data.length() - 1) {
24
-                addChars(encodedDataBuilder, previousChar, previousCharCount);
25
-
26
-                if (previousChar != currentChar && i == data.length() - 1) {
27
-                    addChars(encodedDataBuilder, currentChar, 1);
28
-                }
29
-
30
-                previousChar = currentChar;
31
-                previousCharCount = 1;
32
-            }
33
-        }
34
-
35
-        return encodedDataBuilder.toString();
36
-    }
37
-
38
-    public void addChars(StringBuilder toAddTo, char toAdd, int countOfChar) {
39
-        if(countOfChar != 1) {
40
-            toAddTo.append(countOfChar);
41
-        }
42
-
43
-        countOfChar.append(toAdd);
44
-    }
45
-
46
-    public String decode(String encodedData) {
47
-        StringBuilder decodedData = new StringBuilder();
48
-        Pattern pattern = Pattern.compile("[0-9]+|[a-zA-Z\\s]");
49
-        Matcher matcher = pattern.matcher(encodedData);
50
-
51
-        while (matcher.find()) {
52
-            try {
53
-                int number = Integer.parseInt(matcher.group());
54
-
55
-                matcher.find();
56
-
57
-                for (int i = 0; i<number; i++) {
58
-                    decodedData.append(matcher.group());
59
-                }
60
-            } catch (NumberFormatException e) {
61
-                decodedData.append(matcher.group());
62
-            }
63
-        }
64
-
65
-        return decodedData.toString();
66
-    }
1
+import java.util.regex.Matcher;
2
+import java.util.regex.Pattern;
3
+
4
+public class RunLengthEncoding {
5
+    public String encode(String data) {
6
+
7
+        StringBuilder encodedDataBuilder = new StringBuilder();
8
+
9
+        if (data.length() == 0) {
10
+            return data;
11
+        }
12
+
13
+        int previousCharCount = 1;
14
+        char previousChar = data.charAt(0);
15
+
16
+        for (int i = 1; i < data.length(); i++) {
17
+            char currentChar = data.charAt(i);
18
+
19
+            if (previousChar == currentChar) {
20
+                previousCharCount++;
21
+            }
22
+
23
+            if (previousChar != currentChar || i == data.length() - 1) {
24
+                addChars(encodedDataBuilder, previousChar, previousCharCount);
25
+
26
+                if (previousChar != currentChar && i == data.length() - 1) {
27
+                    addChars(encodedDataBuilder, currentChar, 1);
28
+                }
29
+
30
+                previousChar = currentChar;
31
+                previousCharCount = 1;
32
+            }
33
+        }
34
+
35
+        return encodedDataBuilder.toString();
36
+    }
37
+
38
+    public void addChars(StringBuilder toAddTo, char toAdd, int countOfChar) {
39
+        if(countOfChar != 1) {
40
+            toAddTo.append(countOfChar);
41
+        }
42
+
43
+        countOfChar.append(toAdd);
44
+    }
45
+
46
+    public String decode(String encodedData) {
47
+        StringBuilder decodedData = new StringBuilder();
48
+        Pattern pattern = Pattern.compile("[0-9]+|[a-zA-Z\\s]");
49
+        Matcher matcher = pattern.matcher(encodedData);
50
+
51
+        while (matcher.find()) {
52
+            try {
53
+                int number = Integer.parseInt(matcher.group());
54
+
55
+                matcher.find();
56
+
57
+                for (int i = 0; i<number; i++) {
58
+                    decodedData.append(matcher.group());
59
+                }
60
+            } catch (NumberFormatException e) {
61
+                decodedData.append(matcher.group());
62
+            }
63
+        }
64
+
65
+        return decodedData.toString();
66
+    }
67
 }
67
 }

+ 9
- 9
exercises/run-length-encoding/src/main/java/RunLengthEncoding.java 파일 보기

1
-public class RunLengthEncoding {
2
-    public String encode(String data) {
3
-        throw new UnsupportedOperationException("Method has not been implemented yet.");
4
-    }
5
-
6
-    public String decode(String encodedData) {
7
-        throw new UnsupportedOperationException("Method has not been implemented yet.");
8
-    }
9
-}
1
+public class RunLengthEncoding {
2
+    public String encode(String data) {
3
+        throw new UnsupportedOperationException("Method has not been implemented yet.");
4
+    }
5
+
6
+    public String decode(String encodedData) {
7
+        throw new UnsupportedOperationException("Method has not been implemented yet.");
8
+    }
9
+}

+ 110
- 110
exercises/run-length-encoding/src/test/java/RunLengthEncodingTest.java 파일 보기

1
-import org.junit.Assert;
2
-import org.junit.Before;
3
-import org.junit.Ignore;
4
-import org.junit.Test;
5
-
6
-public class RunLengthEncodingTest {
7
-    private RunLengthEncoding runLengthEncoding;
8
-
9
-    @Before
10
-    public void setUp() {
11
-        runLengthEncoding = new RunLengthEncoding();
12
-    }
13
-
14
-    @Test
15
-    public void encodeEmpty() {
16
-        Assert.assertEquals("", runLengthEncoding.encode(""));
17
-    }
18
-
19
-    @Ignore("Remove to run test")
20
-    @Test
21
-    public void encodeWithOnlySingleValues() {
22
-        Assert.assertEquals("XYZ", runLengthEncoding.encode("XYZ"));
23
-    }
24
-
25
-    @Ignore("Remove to run test")
26
-    @Test
27
-    public void encodeWithNoSingleValues() {
28
-        Assert.assertEquals(
29
-                "2A3B4C",
30
-                runLengthEncoding.encode("AABBBCCCC"));
31
-    }
32
-
33
-    @Ignore("Remove to run test")
34
-    @Test
35
-    public void encodeWithMixedValues() {
36
-        Assert.assertEquals(
37
-                "12WB12W3B24WB",
38
-                runLengthEncoding.encode(
39
-                        "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"));
40
-    }
41
-
42
-    @Ignore("Remove to run test")
43
-    @Test
44
-    public void encodeWithWhitespaceValues() {
45
-        Assert.assertEquals(
46
-                "2 hs2q q2w2 ",
47
-                runLengthEncoding.encode("  hsqq qww  "));
48
-    }
49
-
50
-    @Ignore("Remove to run test")
51
-    @Test
52
-    public void encodeWithLowercaseValues() {
53
-        Assert.assertEquals(
54
-                "2a3b4c",
55
-                runLengthEncoding.encode("aabbbcccc"));
56
-    }
57
-
58
-    @Ignore("Remove to run test")
59
-    @Test
60
-    public void decodeEmpty() {
61
-        Assert.assertEquals("", runLengthEncoding.decode(""));
62
-    }
63
-
64
-    @Ignore("Remove to run test")
65
-    @Test
66
-    public void decodeWithOnlySingleValues() {
67
-        Assert.assertEquals(
68
-                "XYZ",
69
-                runLengthEncoding.decode("XYZ"));
70
-    }
71
-
72
-    @Ignore("Remove to run test")
73
-    @Test
74
-    public void decodeWithNoSingleValues() {
75
-        Assert.assertEquals(
76
-                "AABBBCCCC",
77
-                runLengthEncoding.decode("2A3B4C"));
78
-    }
79
-
80
-    @Ignore("Remove to run test")
81
-    @Test
82
-    public void decodeWithMixedValues() {
83
-        Assert.assertEquals(
84
-                "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",
85
-                runLengthEncoding.decode("12WB12W3B24WB"));
86
-    }
87
-
88
-    @Ignore("Remove to run test")
89
-    @Test
90
-    public void decodeWithWhitespaceValues() {
91
-        Assert.assertEquals(
92
-                "  hsqq qww  ",
93
-                runLengthEncoding.decode("2 hs2q q2w2 "));
94
-    }
95
-
96
-    @Ignore("Remove to run test")
97
-    @Test
98
-    public void decodeWithLowercaseValues() {
99
-        Assert.assertEquals(
100
-                "aabbbcccc",
101
-                runLengthEncoding.decode("2a3b4c"));
102
-    }
103
-
104
-    @Ignore("Remove to run test")
105
-    @Test
106
-    public void encodeThenDecode() {
107
-        String inOut = "zzz ZZ  zZ";
108
-        String encoded = runLengthEncoding.encode(inOut);
109
-        Assert.assertEquals(inOut, runLengthEncoding.decode(encoded));
110
-    }
1
+import org.junit.Assert;
2
+import org.junit.Before;
3
+import org.junit.Ignore;
4
+import org.junit.Test;
5
+
6
+public class RunLengthEncodingTest {
7
+    private RunLengthEncoding runLengthEncoding;
8
+
9
+    @Before
10
+    public void setUp() {
11
+        runLengthEncoding = new RunLengthEncoding();
12
+    }
13
+
14
+    @Test
15
+    public void encodeEmpty() {
16
+        Assert.assertEquals("", runLengthEncoding.encode(""));
17
+    }
18
+
19
+    @Ignore("Remove to run test")
20
+    @Test
21
+    public void encodeWithOnlySingleValues() {
22
+        Assert.assertEquals("XYZ", runLengthEncoding.encode("XYZ"));
23
+    }
24
+
25
+    @Ignore("Remove to run test")
26
+    @Test
27
+    public void encodeWithNoSingleValues() {
28
+        Assert.assertEquals(
29
+                "2A3B4C",
30
+                runLengthEncoding.encode("AABBBCCCC"));
31
+    }
32
+
33
+    @Ignore("Remove to run test")
34
+    @Test
35
+    public void encodeWithMixedValues() {
36
+        Assert.assertEquals(
37
+                "12WB12W3B24WB",
38
+                runLengthEncoding.encode(
39
+                        "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"));
40
+    }
41
+
42
+    @Ignore("Remove to run test")
43
+    @Test
44
+    public void encodeWithWhitespaceValues() {
45
+        Assert.assertEquals(
46
+                "2 hs2q q2w2 ",
47
+                runLengthEncoding.encode("  hsqq qww  "));
48
+    }
49
+
50
+    @Ignore("Remove to run test")
51
+    @Test
52
+    public void encodeWithLowercaseValues() {
53
+        Assert.assertEquals(
54
+                "2a3b4c",
55
+                runLengthEncoding.encode("aabbbcccc"));
56
+    }
57
+
58
+    @Ignore("Remove to run test")
59
+    @Test
60
+    public void decodeEmpty() {
61
+        Assert.assertEquals("", runLengthEncoding.decode(""));
62
+    }
63
+
64
+    @Ignore("Remove to run test")
65
+    @Test
66
+    public void decodeWithOnlySingleValues() {
67
+        Assert.assertEquals(
68
+                "XYZ",
69
+                runLengthEncoding.decode("XYZ"));
70
+    }
71
+
72
+    @Ignore("Remove to run test")
73
+    @Test
74
+    public void decodeWithNoSingleValues() {
75
+        Assert.assertEquals(
76
+                "AABBBCCCC",
77
+                runLengthEncoding.decode("2A3B4C"));
78
+    }
79
+
80
+    @Ignore("Remove to run test")
81
+    @Test
82
+    public void decodeWithMixedValues() {
83
+        Assert.assertEquals(
84
+                "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",
85
+                runLengthEncoding.decode("12WB12W3B24WB"));
86
+    }
87
+
88
+    @Ignore("Remove to run test")
89
+    @Test
90
+    public void decodeWithWhitespaceValues() {
91
+        Assert.assertEquals(
92
+                "  hsqq qww  ",
93
+                runLengthEncoding.decode("2 hs2q q2w2 "));
94
+    }
95
+
96
+    @Ignore("Remove to run test")
97
+    @Test
98
+    public void decodeWithLowercaseValues() {
99
+        Assert.assertEquals(
100
+                "aabbbcccc",
101
+                runLengthEncoding.decode("2a3b4c"));
102
+    }
103
+
104
+    @Ignore("Remove to run test")
105
+    @Test
106
+    public void encodeThenDecode() {
107
+        String inOut = "zzz ZZ  zZ";
108
+        String encoded = runLengthEncoding.encode(inOut);
109
+        Assert.assertEquals(inOut, runLengthEncoding.decode(encoded));
110
+    }
111
 }
111
 }