Просмотр исходного кода

Update house tests to sync with canonical data. Closes #1356 (#1392)

* update house version to 2.2.0

* update reference solution to reflect canonical data

* sync house tests with canonical data
Tendai Mudyiwa 8 лет назад
Родитель
Сommit
dc746fe263

+ 2
- 2
exercises/house/.meta/src/reference/java/House.java Просмотреть файл

33
         verse.append("This is the " + CHARACTERS[verseNumber - 1]);
33
         verse.append("This is the " + CHARACTERS[verseNumber - 1]);
34
 
34
 
35
         for (int i = verseNumber - 2; i >= 0; i--) {
35
         for (int i = verseNumber - 2; i >= 0; i--) {
36
-            verse.append("\nthat " + ACTIONS[i] + " the " + CHARACTERS[i]);
36
+            verse.append(" that " + ACTIONS[i] + " the " + CHARACTERS[i]);
37
         }
37
         }
38
 
38
 
39
         return verse.toString();
39
         return verse.toString();
46
             verses[i - startVerse] = verse(i);
46
             verses[i - startVerse] = verse(i);
47
         }
47
         }
48
 
48
 
49
-        return String.join("\n\n", verses);
49
+        return String.join("\n", verses);
50
     }
50
     }
51
 
51
 
52
     String sing() {
52
     String sing() {

+ 1
- 1
exercises/house/.meta/version Просмотреть файл

1
-2.0.0
1
+2.2.0

+ 157
- 172
exercises/house/src/test/java/HouseTest.java Просмотреть файл

25
     @Test
25
     @Test
26
     public void verseTwo() {
26
     public void verseTwo() {
27
         String expected =
27
         String expected =
28
-                "This is the malt\n" +
28
+                "This is the malt " +
29
                 "that lay in the house that Jack built.";
29
                 "that lay in the house that Jack built.";
30
         int verse = 2;
30
         int verse = 2;
31
 
31
 
36
     @Test
36
     @Test
37
     public void verseThree() {
37
     public void verseThree() {
38
         String expected =
38
         String expected =
39
-                "This is the rat\n" +
40
-                "that ate the malt\n" +
39
+                "This is the rat " +
40
+                "that ate the malt " +
41
                 "that lay in the house that Jack built.";
41
                 "that lay in the house that Jack built.";
42
         int verse = 3;
42
         int verse = 3;
43
 
43
 
48
     @Test
48
     @Test
49
     public void verseFour() {
49
     public void verseFour() {
50
         String expected =
50
         String expected =
51
-                "This is the cat\n" +
52
-                "that killed the rat\n" +
53
-                "that ate the malt\n" +
51
+                "This is the cat " +
52
+                "that killed the rat " +
53
+                "that ate the malt " +
54
                 "that lay in the house that Jack built.";
54
                 "that lay in the house that Jack built.";
55
         int verse = 4;
55
         int verse = 4;
56
 
56
 
61
     @Test
61
     @Test
62
     public void verseFive() {
62
     public void verseFive() {
63
         String expected =
63
         String expected =
64
-                "This is the dog\n" +
65
-                "that worried the cat\n" +
66
-                "that killed the rat\n" +
67
-                "that ate the malt\n" +
64
+                "This is the dog " +
65
+                "that worried the cat " +
66
+                "that killed the rat " +
67
+                "that ate the malt " +
68
                 "that lay in the house that Jack built.";
68
                 "that lay in the house that Jack built.";
69
         int verse = 5;
69
         int verse = 5;
70
 
70
 
75
     @Test
75
     @Test
76
     public void verseSix() {
76
     public void verseSix() {
77
         String expected =
77
         String expected =
78
-                "This is the cow with the crumpled horn\n" +
79
-                "that tossed the dog\n" +
80
-                "that worried the cat\n" +
81
-                "that killed the rat\n" +
82
-                "that ate the malt\n" +
78
+                "This is the cow with the crumpled horn " +
79
+                "that tossed the dog " +
80
+                "that worried the cat " +
81
+                "that killed the rat " +
82
+                "that ate the malt " +
83
                 "that lay in the house that Jack built.";
83
                 "that lay in the house that Jack built.";
84
         int verse = 6;
84
         int verse = 6;
85
 
85
 
90
     @Test
90
     @Test
91
     public void verseSeven() {
91
     public void verseSeven() {
92
         String expected =
92
         String expected =
93
-                "This is the maiden all forlorn\n" +
94
-                "that milked the cow with the crumpled horn\n" +
95
-                "that tossed the dog\n" +
96
-                "that worried the cat\n" +
97
-                "that killed the rat\n" +
98
-                "that ate the malt\n" +
93
+                "This is the maiden all forlorn " +
94
+                "that milked the cow with the crumpled horn " +
95
+                "that tossed the dog " +
96
+                "that worried the cat " +
97
+                "that killed the rat " +
98
+                "that ate the malt " +
99
                 "that lay in the house that Jack built.";
99
                 "that lay in the house that Jack built.";
100
         int verse = 7;
100
         int verse = 7;
101
 
101
 
106
     @Test
106
     @Test
107
     public void verseEight() {
107
     public void verseEight() {
108
         String expected =
108
         String expected =
109
-                "This is the man all tattered and torn\n" +
110
-                "that kissed the maiden all forlorn\n" +
111
-                "that milked the cow with the crumpled horn\n" +
112
-                "that tossed the dog\n" +
113
-                "that worried the cat\n" +
114
-                "that killed the rat\n" +
115
-                "that ate the malt\n" +
109
+                "This is the man all tattered and torn " +
110
+                "that kissed the maiden all forlorn " +
111
+                "that milked the cow with the crumpled horn " +
112
+                "that tossed the dog " +
113
+                "that worried the cat " +
114
+                "that killed the rat " +
115
+                "that ate the malt " +
116
                 "that lay in the house that Jack built.";
116
                 "that lay in the house that Jack built.";
117
         int verse = 8;
117
         int verse = 8;
118
 
118
 
123
     @Test
123
     @Test
124
     public void verseNine() {
124
     public void verseNine() {
125
         String expected =
125
         String expected =
126
-                "This is the priest all shaven and shorn\n" +
127
-                "that married the man all tattered and torn\n" +
128
-                "that kissed the maiden all forlorn\n" +
129
-                "that milked the cow with the crumpled horn\n" +
130
-                "that tossed the dog\n" +
131
-                "that worried the cat\n" +
132
-                "that killed the rat\n" +
133
-                "that ate the malt\n" +
126
+                "This is the priest all shaven and shorn " +
127
+                "that married the man all tattered and torn " +
128
+                "that kissed the maiden all forlorn " +
129
+                "that milked the cow with the crumpled horn " +
130
+                "that tossed the dog " +
131
+                "that worried the cat " +
132
+                "that killed the rat " +
133
+                "that ate the malt " +
134
                 "that lay in the house that Jack built.";
134
                 "that lay in the house that Jack built.";
135
         int verse = 9;
135
         int verse = 9;
136
 
136
 
141
     @Test
141
     @Test
142
     public void verse10() {
142
     public void verse10() {
143
         String expected =
143
         String expected =
144
-                "This is the rooster that crowed in the morn\n" +
145
-                "that woke the priest all shaven and shorn\n" +
146
-                "that married the man all tattered and torn\n" +
147
-                "that kissed the maiden all forlorn\n" +
148
-                "that milked the cow with the crumpled horn\n" +
149
-                "that tossed the dog\n" +
150
-                "that worried the cat\n" +
151
-                "that killed the rat\n" +
152
-                "that ate the malt\n" +
144
+                "This is the rooster that crowed in the morn " +
145
+                "that woke the priest all shaven and shorn " +
146
+                "that married the man all tattered and torn " +
147
+                "that kissed the maiden all forlorn " +
148
+                "that milked the cow with the crumpled horn " +
149
+                "that tossed the dog " +
150
+                "that worried the cat " +
151
+                "that killed the rat " +
152
+                "that ate the malt " +
153
                 "that lay in the house that Jack built.";
153
                 "that lay in the house that Jack built.";
154
         int verse = 10;
154
         int verse = 10;
155
 
155
 
160
     @Test
160
     @Test
161
     public void verse11() {
161
     public void verse11() {
162
         String expected =
162
         String expected =
163
-                "This is the farmer sowing his corn\n" +
164
-                "that kept the rooster that crowed in the morn\n" +
165
-                "that woke the priest all shaven and shorn\n" +
166
-                "that married the man all tattered and torn\n" +
167
-                "that kissed the maiden all forlorn\n" +
168
-                "that milked the cow with the crumpled horn\n" +
169
-                "that tossed the dog\n" +
170
-                "that worried the cat\n" +
171
-                "that killed the rat\n" +
172
-                "that ate the malt\n" +
163
+                "This is the farmer sowing his corn " +
164
+                "that kept the rooster that crowed in the morn " +
165
+                "that woke the priest all shaven and shorn " +
166
+                "that married the man all tattered and torn " +
167
+                "that kissed the maiden all forlorn " +
168
+                "that milked the cow with the crumpled horn " +
169
+                "that tossed the dog " +
170
+                "that worried the cat " +
171
+                "that killed the rat " +
172
+                "that ate the malt " +
173
                 "that lay in the house that Jack built.";
173
                 "that lay in the house that Jack built.";
174
         int verse = 11;
174
         int verse = 11;
175
 
175
 
180
     @Test
180
     @Test
181
     public void verse12() {
181
     public void verse12() {
182
         String expected =
182
         String expected =
183
-                "This is the horse and the hound and the horn\n" +
184
-                "that belonged to the farmer sowing his corn\n" +
185
-                "that kept the rooster that crowed in the morn\n" +
186
-                "that woke the priest all shaven and shorn\n" +
187
-                "that married the man all tattered and torn\n" +
188
-                "that kissed the maiden all forlorn\n" +
189
-                "that milked the cow with the crumpled horn\n" +
190
-                "that tossed the dog\n" +
191
-                "that worried the cat\n" +
192
-                "that killed the rat\n" +
193
-                "that ate the malt\n" +
183
+                "This is the horse and the hound and the horn " +
184
+                "that belonged to the farmer sowing his corn " +
185
+                "that kept the rooster that crowed in the morn " +
186
+                "that woke the priest all shaven and shorn " +
187
+                "that married the man all tattered and torn " +
188
+                "that kissed the maiden all forlorn " +
189
+                "that milked the cow with the crumpled horn " +
190
+                "that tossed the dog " +
191
+                "that worried the cat " +
192
+                "that killed the rat " +
193
+                "that ate the malt " +
194
                 "that lay in the house that Jack built.";
194
                 "that lay in the house that Jack built.";
195
         int verse = 12;
195
         int verse = 12;
196
 
196
 
201
     @Test
201
     @Test
202
     public void multipleVerses() {
202
     public void multipleVerses() {
203
         String expected =
203
         String expected =
204
-                "This is the cat\n" +
205
-                "that killed the rat\n" +
206
-                "that ate the malt\n" +
204
+                "This is the cat " +
205
+                "that killed the rat " +
206
+                "that ate the malt " +
207
                 "that lay in the house that Jack built.\n" +
207
                 "that lay in the house that Jack built.\n" +
208
-                "\n" +
209
-                "This is the dog\n" +
210
-                "that worried the cat\n" +
211
-                "that killed the rat\n" +
212
-                "that ate the malt\n" +
208
+                "This is the dog " +
209
+                "that worried the cat " +
210
+                "that killed the rat " +
211
+                "that ate the malt " +
213
                 "that lay in the house that Jack built.\n" +
212
                 "that lay in the house that Jack built.\n" +
214
-                "\n" +
215
-                "This is the cow with the crumpled horn\n" +
216
-                "that tossed the dog\n" +
217
-                "that worried the cat\n" +
218
-                "that killed the rat\n" +
219
-                "that ate the malt\n" +
213
+                "This is the cow with the crumpled horn " +
214
+                "that tossed the dog " +
215
+                "that worried the cat " +
216
+                "that killed the rat " +
217
+                "that ate the malt " +
220
                 "that lay in the house that Jack built.\n" +
218
                 "that lay in the house that Jack built.\n" +
221
-                "\n" +
222
-                "This is the maiden all forlorn\n" +
223
-                "that milked the cow with the crumpled horn\n" +
224
-                "that tossed the dog\n" +
225
-                "that worried the cat\n" +
226
-                "that killed the rat\n" +
227
-                "that ate the malt\n" +
219
+                "This is the maiden all forlorn " +
220
+                "that milked the cow with the crumpled horn " +
221
+                "that tossed the dog " +
222
+                "that worried the cat " +
223
+                "that killed the rat " +
224
+                "that ate the malt " +
228
                 "that lay in the house that Jack built.\n" +
225
                 "that lay in the house that Jack built.\n" +
229
-                "\n" +
230
-                "This is the man all tattered and torn\n" +
231
-                "that kissed the maiden all forlorn\n" +
232
-                "that milked the cow with the crumpled horn\n" +
233
-                "that tossed the dog\n" +
234
-                "that worried the cat\n" +
235
-                "that killed the rat\n" +
236
-                "that ate the malt\n" +
226
+                "This is the man all tattered and torn " +
227
+                "that kissed the maiden all forlorn " +
228
+                "that milked the cow with the crumpled horn " +
229
+                "that tossed the dog " +
230
+                "that worried the cat " +
231
+                "that killed the rat " +
232
+                "that ate the malt " +
237
                 "that lay in the house that Jack built.";
233
                 "that lay in the house that Jack built.";
238
 
234
 
239
         int startVerse = 4;
235
         int startVerse = 4;
247
     public void wholeRhyme() {
243
     public void wholeRhyme() {
248
         String expected =
244
         String expected =
249
                 "This is the house that Jack built.\n" +
245
                 "This is the house that Jack built.\n" +
250
-                "\n" +
251
-                "This is the malt\n" +
246
+                "This is the malt " +
252
                 "that lay in the house that Jack built.\n" +
247
                 "that lay in the house that Jack built.\n" +
253
-                "\n" +
254
-                "This is the rat\n" +
255
-                "that ate the malt\n" +
248
+                "This is the rat " +
249
+                "that ate the malt " +
256
                 "that lay in the house that Jack built.\n" +
250
                 "that lay in the house that Jack built.\n" +
257
-                "\n" +
258
-                "This is the cat\n" +
259
-                "that killed the rat\n" +
260
-                "that ate the malt\n" +
251
+                "This is the cat " +
252
+                "that killed the rat " +
253
+                "that ate the malt " +
261
                 "that lay in the house that Jack built.\n" +
254
                 "that lay in the house that Jack built.\n" +
262
-                "\n" +
263
-                "This is the dog\n" +
264
-                "that worried the cat\n" +
265
-                "that killed the rat\n" +
266
-                "that ate the malt\n" +
255
+                "This is the dog " +
256
+                "that worried the cat " +
257
+                "that killed the rat " +
258
+                "that ate the malt " +
267
                 "that lay in the house that Jack built.\n" +
259
                 "that lay in the house that Jack built.\n" +
268
-                "\n" +
269
-                "This is the cow with the crumpled horn\n" +
270
-                "that tossed the dog\n" +
271
-                "that worried the cat\n" +
272
-                "that killed the rat\n" +
273
-                "that ate the malt\n" +
260
+                "This is the cow with the crumpled horn " +
261
+                "that tossed the dog " +
262
+                "that worried the cat " +
263
+                "that killed the rat " +
264
+                "that ate the malt " +
274
                 "that lay in the house that Jack built.\n" +
265
                 "that lay in the house that Jack built.\n" +
275
-                "\n" +
276
-                "This is the maiden all forlorn\n" +
277
-                "that milked the cow with the crumpled horn\n" +
278
-                "that tossed the dog\n" +
279
-                "that worried the cat\n" +
280
-                "that killed the rat\n" +
281
-                "that ate the malt\n" +
266
+                "This is the maiden all forlorn " +
267
+                "that milked the cow with the crumpled horn " +
268
+                "that tossed the dog " +
269
+                "that worried the cat " +
270
+                "that killed the rat " +
271
+                "that ate the malt " +
282
                 "that lay in the house that Jack built.\n" +
272
                 "that lay in the house that Jack built.\n" +
283
-                "\n" +
284
-                "This is the man all tattered and torn\n" +
285
-                "that kissed the maiden all forlorn\n" +
286
-                "that milked the cow with the crumpled horn\n" +
287
-                "that tossed the dog\n" +
288
-                "that worried the cat\n" +
289
-                "that killed the rat\n" +
290
-                "that ate the malt\n" +
273
+                "This is the man all tattered and torn " +
274
+                "that kissed the maiden all forlorn " +
275
+                "that milked the cow with the crumpled horn " +
276
+                "that tossed the dog " +
277
+                "that worried the cat " +
278
+                "that killed the rat " +
279
+                "that ate the malt " +
291
                 "that lay in the house that Jack built.\n" +
280
                 "that lay in the house that Jack built.\n" +
292
-                "\n" +
293
-                "This is the priest all shaven and shorn\n" +
294
-                "that married the man all tattered and torn\n" +
295
-                "that kissed the maiden all forlorn\n" +
296
-                "that milked the cow with the crumpled horn\n" +
297
-                "that tossed the dog\n" +
298
-                "that worried the cat\n" +
299
-                "that killed the rat\n" +
300
-                "that ate the malt\n" +
281
+                "This is the priest all shaven and shorn " +
282
+                "that married the man all tattered and torn " +
283
+                "that kissed the maiden all forlorn " +
284
+                "that milked the cow with the crumpled horn " +
285
+                "that tossed the dog " +
286
+                "that worried the cat " +
287
+                "that killed the rat " +
288
+                "that ate the malt " +
301
                 "that lay in the house that Jack built.\n" +
289
                 "that lay in the house that Jack built.\n" +
302
-                "\n" +
303
-                "This is the rooster that crowed in the morn\n" +
304
-                "that woke the priest all shaven and shorn\n" +
305
-                "that married the man all tattered and torn\n" +
306
-                "that kissed the maiden all forlorn\n" +
307
-                "that milked the cow with the crumpled horn\n" +
308
-                "that tossed the dog\n" +
309
-                "that worried the cat\n" +
310
-                "that killed the rat\n" +
311
-                "that ate the malt\n" +
290
+                "This is the rooster that crowed in the morn " +
291
+                "that woke the priest all shaven and shorn " +
292
+                "that married the man all tattered and torn " +
293
+                "that kissed the maiden all forlorn " +
294
+                "that milked the cow with the crumpled horn " +
295
+                "that tossed the dog " +
296
+                "that worried the cat " +
297
+                "that killed the rat " +
298
+                "that ate the malt " +
312
                 "that lay in the house that Jack built.\n" +
299
                 "that lay in the house that Jack built.\n" +
313
-                "\n" +
314
-                "This is the farmer sowing his corn\n" +
315
-                "that kept the rooster that crowed in the morn\n" +
316
-                "that woke the priest all shaven and shorn\n" +
317
-                "that married the man all tattered and torn\n" +
318
-                "that kissed the maiden all forlorn\n" +
319
-                "that milked the cow with the crumpled horn\n" +
320
-                "that tossed the dog\n" +
321
-                "that worried the cat\n" +
322
-                "that killed the rat\n" +
323
-                "that ate the malt\n" +
300
+                "This is the farmer sowing his corn " +
301
+                "that kept the rooster that crowed in the morn " +
302
+                "that woke the priest all shaven and shorn " +
303
+                "that married the man all tattered and torn " +
304
+                "that kissed the maiden all forlorn " +
305
+                "that milked the cow with the crumpled horn " +
306
+                "that tossed the dog " +
307
+                "that worried the cat " +
308
+                "that killed the rat " +
309
+                "that ate the malt " +
324
                 "that lay in the house that Jack built.\n" +
310
                 "that lay in the house that Jack built.\n" +
325
-                "\n" +
326
-                "This is the horse and the hound and the horn\n" +
327
-                "that belonged to the farmer sowing his corn\n" +
328
-                "that kept the rooster that crowed in the morn\n" +
329
-                "that woke the priest all shaven and shorn\n" +
330
-                "that married the man all tattered and torn\n" +
331
-                "that kissed the maiden all forlorn\n" +
332
-                "that milked the cow with the crumpled horn\n" +
333
-                "that tossed the dog\n" +
334
-                "that worried the cat\n" +
335
-                "that killed the rat\n" +
336
-                "that ate the malt\n" +
311
+                "This is the horse and the hound and the horn " +
312
+                "that belonged to the farmer sowing his corn " +
313
+                "that kept the rooster that crowed in the morn " +
314
+                "that woke the priest all shaven and shorn " +
315
+                "that married the man all tattered and torn " +
316
+                "that kissed the maiden all forlorn " +
317
+                "that milked the cow with the crumpled horn " +
318
+                "that tossed the dog " +
319
+                "that worried the cat " +
320
+                "that killed the rat " +
321
+                "that ate the malt " +
337
                 "that lay in the house that Jack built.";
322
                 "that lay in the house that Jack built.";
338
 
323
 
339
         assertEquals(expected, house.sing());
324
         assertEquals(expected, house.sing());