trackler 2.2.1.60 → 2.2.1.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/beer-song/canonical-data.json +366 -31
- data/problem-specifications/exercises/beer-song/description.md +1 -1
- data/problem-specifications/exercises/pascals-triangle/canonical-data.json +19 -1
- data/problem-specifications/exercises/proverb/canonical-data.json +91 -0
- data/problem-specifications/exercises/proverb/description.md +5 -3
- data/tracks/c/README.md +0 -10
- data/tracks/c/config/maintainers.json +45 -0
- data/tracks/c/config.json +1 -2
- data/tracks/c/docs/TESTS.md +43 -44
- data/tracks/d/docs/INSTALLATION.md +1 -1
- data/tracks/delphi/exercises/beer-song/README.md +1 -1
- data/tracks/delphi/exercises/beer-song/inputdata.txt +3 -1
- data/tracks/delphi/exercises/beer-song/uBeerSongExample.pas +14 -5
- data/tracks/delphi/exercises/beer-song/uBeerSongTests.pas +58 -42
- data/tracks/delphi/exercises/nucleotide-count/README.md +2 -2
- data/tracks/ecmascript/config.json +14 -0
- data/tracks/ecmascript/exercises/house/README.md +146 -0
- data/tracks/ecmascript/exercises/house/example.js +62 -0
- data/tracks/ecmascript/exercises/house/house.spec.js +292 -0
- data/tracks/ecmascript/exercises/house/package.json +71 -0
- data/tracks/go/exercises/allergies/example.go +3 -2
- data/tracks/go/exercises/custom-set/cases_test.go +7 -2
- data/tracks/go/exercises/isogram/.meta/gen.go +55 -0
- data/tracks/go/exercises/isogram/cases_test.go +57 -0
- data/tracks/go/exercises/isogram/isogram_test.go +4 -20
- data/tracks/java/config.json +7 -1
- data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +6 -1
- data/tracks/javascript/.eslintignore +0 -3
- data/tracks/javascript/exercises/acronym/example.js +2 -1
- data/tracks/javascript/exercises/diamond/diamond.spec.js +3 -3
- data/tracks/javascript/exercises/diamond/example.js +2 -2
- data/tracks/javascript/exercises/sum-of-multiples/sum-of-multiples.spec.js +9 -9
- data/tracks/python/config.json +33 -11
- data/tracks/python/exercises/dominoes/README.md +28 -0
- data/tracks/python/exercises/dominoes/dominoes.py +2 -0
- data/tracks/python/exercises/dominoes/dominoes_test.py +114 -0
- data/tracks/python/exercises/dominoes/example.py +30 -0
- data/tracks/python/exercises/grains/grains_test.py +5 -7
- data/tracks/python/exercises/phone-number/example.py +7 -13
- data/tracks/python/exercises/phone-number/phone_number_test.py +15 -15
- data/tracks/python/exercises/poker/poker_test.py +93 -52
- data/tracks/python/exercises/react/README.md +30 -0
- data/tracks/python/exercises/react/example.py +65 -0
- data/tracks/python/exercises/react/react.py +17 -0
- data/tracks/python/exercises/react/react_test.py +136 -0
- data/tracks/rust/exercises/pascals-triangle/Cargo.toml +1 -1
- data/tracks/rust/exercises/pascals-triangle/tests/pascals-triangle.rs +56 -0
- data/tracks/swift/Package.swift +1 -1
- data/tracks/swift/config.json +11 -0
- data/tracks/swift/exercises/atbash-cipher/Sources/AtbashExample.swift +1 -1
- data/tracks/swift/exercises/bracket-push/Sources/BracketPushExample.swift +1 -1
- data/tracks/swift/exercises/collatz-conjecture/Package.swift +5 -0
- data/tracks/swift/exercises/collatz-conjecture/README.md +41 -0
- data/tracks/swift/exercises/collatz-conjecture/Sources/CollatzConjecture.swift +1 -0
- data/tracks/swift/exercises/collatz-conjecture/Sources/CollatzConjectureExample.swift +27 -0
- data/tracks/swift/exercises/collatz-conjecture/Tests/CollatzConjectureTests/CollatzConjectureTests.swift +40 -0
- data/tracks/swift/exercises/collatz-conjecture/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/dominoes/Sources/DominoesExample.swift +3 -3
- data/tracks/swift/exercises/grains/Tests/GrainsTests/GrainsTests.swift +3 -3
- data/tracks/swift/exercises/kindergarten-garden/Sources/KindergartenGardenExample.swift +2 -2
- data/tracks/swift/exercises/meetup/Sources/MeetupExample.swift +1 -1
- data/tracks/swift/exercises/nucleotide-count/Sources/NucleotideCountExample.swift +2 -2
- data/tracks/swift/exercises/poker/Sources/PokerExample.swift +137 -131
- data/tracks/swift/exercises/rna-transcription/Sources/RnaTranscriptionExample.swift +2 -2
- data/tracks/swift/exercises/rotational-cipher/Sources/RotationalCipherExample.swift +12 -12
- metadata +24 -2
@@ -0,0 +1,62 @@
|
|
1
|
+
const OBJECTS = [
|
2
|
+
'house',
|
3
|
+
'malt',
|
4
|
+
'rat',
|
5
|
+
'cat',
|
6
|
+
'dog',
|
7
|
+
'cow with the crumpled horn',
|
8
|
+
'maiden all forlorn',
|
9
|
+
'man all tattered and torn',
|
10
|
+
'priest all shaven and shorn',
|
11
|
+
'rooster that crowed in the morn',
|
12
|
+
'farmer sowing his corn',
|
13
|
+
'horse and the hound and the horn',
|
14
|
+
];
|
15
|
+
|
16
|
+
const ACTIONS = [
|
17
|
+
'Jack built',
|
18
|
+
'lay in',
|
19
|
+
'ate',
|
20
|
+
'killed',
|
21
|
+
'worried',
|
22
|
+
'tossed',
|
23
|
+
'milked',
|
24
|
+
'kissed',
|
25
|
+
'married',
|
26
|
+
'woke',
|
27
|
+
'kept',
|
28
|
+
'belonged to',
|
29
|
+
];
|
30
|
+
|
31
|
+
class House {
|
32
|
+
static verse(verseNumber) {
|
33
|
+
const lines = [];
|
34
|
+
const totalLines = verseNumber;
|
35
|
+
let itemIndex = verseNumber - 1;
|
36
|
+
for (let lineNumber = 1; lineNumber <= totalLines; lineNumber += 1) {
|
37
|
+
let lineText = '';
|
38
|
+
if (lineNumber === 1) lineText += 'This is';
|
39
|
+
else {
|
40
|
+
lineText += `that ${ACTIONS[itemIndex]}`;
|
41
|
+
itemIndex -= 1;
|
42
|
+
}
|
43
|
+
|
44
|
+
lineText += ` the ${OBJECTS[itemIndex]}`;
|
45
|
+
if (lineNumber === totalLines) lineText += ` that ${ACTIONS[itemIndex]}.`;
|
46
|
+
lines.push(lineText);
|
47
|
+
}
|
48
|
+
return lines;
|
49
|
+
}
|
50
|
+
|
51
|
+
static verses(start, end) {
|
52
|
+
let lines = [];
|
53
|
+
for (let i = start; i <= end; i += 1) {
|
54
|
+
const verseLines = House.verse(i);
|
55
|
+
lines = lines.concat(verseLines);
|
56
|
+
if (i < end) lines.push('');
|
57
|
+
}
|
58
|
+
return lines;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
export default House;
|
@@ -0,0 +1,292 @@
|
|
1
|
+
import House from './house';
|
2
|
+
|
3
|
+
describe('House', () => {
|
4
|
+
test('verse one - the house that jack built', () => {
|
5
|
+
const lyrics = [
|
6
|
+
'This is the house that Jack built.',
|
7
|
+
];
|
8
|
+
expect(House.verse(1)).toEqual(lyrics);
|
9
|
+
});
|
10
|
+
|
11
|
+
xtest('verse two - the malt that lay', () => {
|
12
|
+
const lyrics = [
|
13
|
+
'This is the malt',
|
14
|
+
'that lay in the house that Jack built.',
|
15
|
+
];
|
16
|
+
expect(House.verse(2)).toEqual(lyrics);
|
17
|
+
});
|
18
|
+
|
19
|
+
xtest('verse three - the rat that ate', () => {
|
20
|
+
const lyrics = [
|
21
|
+
'This is the rat',
|
22
|
+
'that ate the malt',
|
23
|
+
'that lay in the house that Jack built.',
|
24
|
+
];
|
25
|
+
expect(House.verse(3)).toEqual(lyrics);
|
26
|
+
});
|
27
|
+
|
28
|
+
xtest('verse four - the cat that killed', () => {
|
29
|
+
const lyrics = [
|
30
|
+
'This is the cat',
|
31
|
+
'that killed the rat',
|
32
|
+
'that ate the malt',
|
33
|
+
'that lay in the house that Jack built.',
|
34
|
+
];
|
35
|
+
expect(House.verse(4)).toEqual(lyrics);
|
36
|
+
});
|
37
|
+
|
38
|
+
xtest('verse five - the dog that worried', () => {
|
39
|
+
const lyrics = [
|
40
|
+
'This is the dog',
|
41
|
+
'that worried the cat',
|
42
|
+
'that killed the rat',
|
43
|
+
'that ate the malt',
|
44
|
+
'that lay in the house that Jack built.',
|
45
|
+
];
|
46
|
+
expect(House.verse(5)).toEqual(lyrics);
|
47
|
+
});
|
48
|
+
|
49
|
+
xtest('verse six - the cow with the crumpled horn', () => {
|
50
|
+
const lyrics = [
|
51
|
+
'This is the cow with the crumpled horn',
|
52
|
+
'that tossed the dog',
|
53
|
+
'that worried the cat',
|
54
|
+
'that killed the rat',
|
55
|
+
'that ate the malt',
|
56
|
+
'that lay in the house that Jack built.',
|
57
|
+
];
|
58
|
+
expect(House.verse(6)).toEqual(lyrics);
|
59
|
+
});
|
60
|
+
|
61
|
+
xtest('verse seven - the maiden all forlorn', () => {
|
62
|
+
const lyrics = [
|
63
|
+
'This is the maiden all forlorn',
|
64
|
+
'that milked the cow with the crumpled horn',
|
65
|
+
'that tossed the dog',
|
66
|
+
'that worried the cat',
|
67
|
+
'that killed the rat',
|
68
|
+
'that ate the malt',
|
69
|
+
'that lay in the house that Jack built.',
|
70
|
+
];
|
71
|
+
expect(House.verse(7)).toEqual(lyrics);
|
72
|
+
});
|
73
|
+
|
74
|
+
xtest('verse eight - the man all tattered and torn', () => {
|
75
|
+
const lyrics = [
|
76
|
+
'This is the man all tattered and torn',
|
77
|
+
'that kissed the maiden all forlorn',
|
78
|
+
'that milked 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.',
|
84
|
+
];
|
85
|
+
expect(House.verse(8)).toEqual(lyrics);
|
86
|
+
});
|
87
|
+
|
88
|
+
xtest('verse nine - the priest all shaven and shorn', () => {
|
89
|
+
const lyrics = [
|
90
|
+
'This is the priest all shaven and shorn',
|
91
|
+
'that married the man all tattered and torn',
|
92
|
+
'that kissed the maiden all forlorn',
|
93
|
+
'that milked the cow with the crumpled horn',
|
94
|
+
'that tossed the dog',
|
95
|
+
'that worried the cat',
|
96
|
+
'that killed the rat',
|
97
|
+
'that ate the malt',
|
98
|
+
'that lay in the house that Jack built.',
|
99
|
+
];
|
100
|
+
expect(House.verse(9)).toEqual(lyrics);
|
101
|
+
});
|
102
|
+
|
103
|
+
xtest('verse ten - the rooster that crowed in the morn', () => {
|
104
|
+
const lyrics = [
|
105
|
+
'This is the rooster that crowed in the morn',
|
106
|
+
'that woke the priest all shaven and shorn',
|
107
|
+
'that married the man all tattered and torn',
|
108
|
+
'that kissed the maiden all forlorn',
|
109
|
+
'that milked the cow with the crumpled horn',
|
110
|
+
'that tossed the dog',
|
111
|
+
'that worried the cat',
|
112
|
+
'that killed the rat',
|
113
|
+
'that ate the malt',
|
114
|
+
'that lay in the house that Jack built.',
|
115
|
+
];
|
116
|
+
expect(House.verse(10)).toEqual(lyrics);
|
117
|
+
});
|
118
|
+
|
119
|
+
xtest('verse eleven - the farmer sowing his corn', () => {
|
120
|
+
const lyrics = [
|
121
|
+
'This is the farmer sowing his corn',
|
122
|
+
'that kept the rooster that crowed in the morn',
|
123
|
+
'that woke the priest all shaven and shorn',
|
124
|
+
'that married the man all tattered and torn',
|
125
|
+
'that kissed the maiden all forlorn',
|
126
|
+
'that milked the cow with the crumpled horn',
|
127
|
+
'that tossed the dog',
|
128
|
+
'that worried the cat',
|
129
|
+
'that killed the rat',
|
130
|
+
'that ate the malt',
|
131
|
+
'that lay in the house that Jack built.',
|
132
|
+
];
|
133
|
+
expect(House.verse(11)).toEqual(lyrics);
|
134
|
+
});
|
135
|
+
|
136
|
+
xtest('verse twelve - the horse and the hound and the horn', () => {
|
137
|
+
const lyrics = [
|
138
|
+
'This is the horse and the hound and the horn',
|
139
|
+
'that belonged to the farmer sowing his corn',
|
140
|
+
'that kept the rooster that crowed in the morn',
|
141
|
+
'that woke the priest all shaven and shorn',
|
142
|
+
'that married the man all tattered and torn',
|
143
|
+
'that kissed the maiden all forlorn',
|
144
|
+
'that milked the cow with the crumpled horn',
|
145
|
+
'that tossed the dog',
|
146
|
+
'that worried the cat',
|
147
|
+
'that killed the rat',
|
148
|
+
'that ate the malt',
|
149
|
+
'that lay in the house that Jack built.',
|
150
|
+
];
|
151
|
+
expect(House.verse(12)).toEqual(lyrics);
|
152
|
+
});
|
153
|
+
|
154
|
+
xtest('multiple verses', () => {
|
155
|
+
const startVerse = 4;
|
156
|
+
const endVerse = 8;
|
157
|
+
const lyrics = [
|
158
|
+
'This is the cat',
|
159
|
+
'that killed the rat',
|
160
|
+
'that ate the malt',
|
161
|
+
'that lay in the house that Jack built.',
|
162
|
+
'',
|
163
|
+
'This is the dog',
|
164
|
+
'that worried the cat',
|
165
|
+
'that killed the rat',
|
166
|
+
'that ate the malt',
|
167
|
+
'that lay in the house that Jack built.',
|
168
|
+
'',
|
169
|
+
'This is the cow with the crumpled horn',
|
170
|
+
'that tossed the dog',
|
171
|
+
'that worried the cat',
|
172
|
+
'that killed the rat',
|
173
|
+
'that ate the malt',
|
174
|
+
'that lay in the house that Jack built.',
|
175
|
+
'',
|
176
|
+
'This is the maiden all forlorn',
|
177
|
+
'that milked the cow with the crumpled horn',
|
178
|
+
'that tossed the dog',
|
179
|
+
'that worried the cat',
|
180
|
+
'that killed the rat',
|
181
|
+
'that ate the malt',
|
182
|
+
'that lay in the house that Jack built.',
|
183
|
+
'',
|
184
|
+
'This is the man all tattered and torn',
|
185
|
+
'that kissed the maiden all forlorn',
|
186
|
+
'that milked the cow with the crumpled horn',
|
187
|
+
'that tossed the dog',
|
188
|
+
'that worried the cat',
|
189
|
+
'that killed the rat',
|
190
|
+
'that ate the malt',
|
191
|
+
'that lay in the house that Jack built.',
|
192
|
+
];
|
193
|
+
expect(House.verses(startVerse, endVerse)).toEqual(lyrics);
|
194
|
+
});
|
195
|
+
|
196
|
+
xtest('full rhyme', () => {
|
197
|
+
const startVerse = 1;
|
198
|
+
const endVerse = 12;
|
199
|
+
const lyrics = [
|
200
|
+
'This is the house that Jack built.',
|
201
|
+
'',
|
202
|
+
'This is the malt',
|
203
|
+
'that lay in the house that Jack built.',
|
204
|
+
'',
|
205
|
+
'This is the rat',
|
206
|
+
'that ate the malt',
|
207
|
+
'that lay in the house that Jack built.',
|
208
|
+
'',
|
209
|
+
'This is the cat',
|
210
|
+
'that killed the rat',
|
211
|
+
'that ate the malt',
|
212
|
+
'that lay in the house that Jack built.',
|
213
|
+
'',
|
214
|
+
'This is the dog',
|
215
|
+
'that worried the cat',
|
216
|
+
'that killed the rat',
|
217
|
+
'that ate the malt',
|
218
|
+
'that lay in the house that Jack built.',
|
219
|
+
'',
|
220
|
+
'This is 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',
|
225
|
+
'that lay in the house that Jack built.',
|
226
|
+
'',
|
227
|
+
'This is 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',
|
233
|
+
'that lay in the house that Jack built.',
|
234
|
+
'',
|
235
|
+
'This is the man all tattered and torn',
|
236
|
+
'that kissed the maiden all forlorn',
|
237
|
+
'that milked the cow with the crumpled horn',
|
238
|
+
'that tossed the dog',
|
239
|
+
'that worried the cat',
|
240
|
+
'that killed the rat',
|
241
|
+
'that ate the malt',
|
242
|
+
'that lay in the house that Jack built.',
|
243
|
+
'',
|
244
|
+
'This is the priest all shaven and shorn',
|
245
|
+
'that married the man all tattered and torn',
|
246
|
+
'that kissed the maiden all forlorn',
|
247
|
+
'that milked the cow with the crumpled horn',
|
248
|
+
'that tossed the dog',
|
249
|
+
'that worried the cat',
|
250
|
+
'that killed the rat',
|
251
|
+
'that ate the malt',
|
252
|
+
'that lay in the house that Jack built.',
|
253
|
+
'',
|
254
|
+
'This is the rooster that crowed in the morn',
|
255
|
+
'that woke the priest all shaven and shorn',
|
256
|
+
'that married the man all tattered and torn',
|
257
|
+
'that kissed the maiden all forlorn',
|
258
|
+
'that milked the cow with the crumpled horn',
|
259
|
+
'that tossed the dog',
|
260
|
+
'that worried the cat',
|
261
|
+
'that killed the rat',
|
262
|
+
'that ate the malt',
|
263
|
+
'that lay in the house that Jack built.',
|
264
|
+
'',
|
265
|
+
'This is the farmer sowing his corn',
|
266
|
+
'that kept the rooster that crowed in the morn',
|
267
|
+
'that woke the priest all shaven and shorn',
|
268
|
+
'that married the man all tattered and torn',
|
269
|
+
'that kissed the maiden all forlorn',
|
270
|
+
'that milked the cow with the crumpled horn',
|
271
|
+
'that tossed the dog',
|
272
|
+
'that worried the cat',
|
273
|
+
'that killed the rat',
|
274
|
+
'that ate the malt',
|
275
|
+
'that lay in the house that Jack built.',
|
276
|
+
'',
|
277
|
+
'This is the horse and the hound and the horn',
|
278
|
+
'that belonged to the farmer sowing his corn',
|
279
|
+
'that kept the rooster that crowed in the morn',
|
280
|
+
'that woke the priest all shaven and shorn',
|
281
|
+
'that married the man all tattered and torn',
|
282
|
+
'that kissed the maiden all forlorn',
|
283
|
+
'that milked the cow with the crumpled horn',
|
284
|
+
'that tossed the dog',
|
285
|
+
'that worried the cat',
|
286
|
+
'that killed the rat',
|
287
|
+
'that ate the malt',
|
288
|
+
'that lay in the house that Jack built.',
|
289
|
+
];
|
290
|
+
expect(House.verses(startVerse, endVerse)).toEqual(lyrics);
|
291
|
+
});
|
292
|
+
});
|
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"name": "xecmascript",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"description": "Exercism exercises in ECMAScript 6.",
|
5
|
+
"author": "Katrina Owen",
|
6
|
+
"private": true,
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/exercism/xecmascript"
|
10
|
+
},
|
11
|
+
"devDependencies": {
|
12
|
+
"babel-jest": "^21.2.0",
|
13
|
+
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
14
|
+
"babel-preset-env": "^1.4.0",
|
15
|
+
"eslint": "^3.19.0",
|
16
|
+
"eslint-config-airbnb": "^15.0.1",
|
17
|
+
"eslint-plugin-import": "^2.2.0",
|
18
|
+
"eslint-plugin-jsx-a11y": "^5.0.1",
|
19
|
+
"eslint-plugin-react": "^7.0.1",
|
20
|
+
"jest": "^21.2.1"
|
21
|
+
},
|
22
|
+
"jest": {
|
23
|
+
"modulePathIgnorePatterns": [
|
24
|
+
"package.json"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
"babel": {
|
28
|
+
"presets": [
|
29
|
+
"env"
|
30
|
+
],
|
31
|
+
"plugins": [
|
32
|
+
[
|
33
|
+
"babel-plugin-transform-builtin-extend",
|
34
|
+
{
|
35
|
+
"globals": [
|
36
|
+
"Error"
|
37
|
+
]
|
38
|
+
}
|
39
|
+
],
|
40
|
+
[
|
41
|
+
"transform-regenerator"
|
42
|
+
]
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"scripts": {
|
46
|
+
"test": "jest --no-cache ./*",
|
47
|
+
"watch": "jest --no-cache --watch ./*",
|
48
|
+
"lint": "eslint .",
|
49
|
+
"lint-test": "eslint . && jest --no-cache ./* "
|
50
|
+
},
|
51
|
+
"eslintConfig": {
|
52
|
+
"parserOptions": {
|
53
|
+
"ecmaVersion": 6,
|
54
|
+
"sourceType": "module"
|
55
|
+
},
|
56
|
+
"env": {
|
57
|
+
"es6": true,
|
58
|
+
"node": true,
|
59
|
+
"jest": true
|
60
|
+
},
|
61
|
+
"extends": "airbnb",
|
62
|
+
"rules": {
|
63
|
+
"import/no-unresolved": "off",
|
64
|
+
"import/extensions": "off"
|
65
|
+
}
|
66
|
+
},
|
67
|
+
"licenses": [
|
68
|
+
"MIT"
|
69
|
+
],
|
70
|
+
"dependencies": {}
|
71
|
+
}
|
@@ -4,10 +4,11 @@ import "math"
|
|
4
4
|
|
5
5
|
var allergens = []string{"eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}
|
6
6
|
|
7
|
-
func Allergies(i uint)
|
7
|
+
func Allergies(i uint) []string {
|
8
|
+
var result []string
|
8
9
|
for _, v := range allergens {
|
9
10
|
if AllergicTo(i, v) {
|
10
|
-
result = append(result,
|
11
|
+
result = append(result, v)
|
11
12
|
}
|
12
13
|
}
|
13
14
|
return result
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package stringset
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.0
|
4
|
+
// Commit: 390a769 custom-set: add test for inequality of subset (#991)
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
// Returns true if the set contains no elements
|
8
8
|
var emptyCases = []unaryBoolCase{
|
@@ -129,6 +129,11 @@ var equalCases = []binBoolCase{
|
|
129
129
|
[]string{"a", "b", "d"},
|
130
130
|
false,
|
131
131
|
},
|
132
|
+
{ // set is not equal to larger set with same elements
|
133
|
+
[]string{"a", "b", "c"},
|
134
|
+
[]string{"a", "b", "c", "d"},
|
135
|
+
false,
|
136
|
+
},
|
132
137
|
}
|
133
138
|
|
134
139
|
// Unique elements can be added to a set
|
@@ -0,0 +1,55 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"log"
|
5
|
+
"text/template"
|
6
|
+
|
7
|
+
"../../../gen"
|
8
|
+
)
|
9
|
+
|
10
|
+
func main() {
|
11
|
+
t, err := template.New("").Parse(tmpl)
|
12
|
+
if err != nil {
|
13
|
+
log.Fatal(err)
|
14
|
+
}
|
15
|
+
var j js
|
16
|
+
if err := gen.Gen("isogram", &j, t); err != nil {
|
17
|
+
log.Fatal(err)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
// The JSON structure we expect to be able to unmarshal into
|
22
|
+
type js struct {
|
23
|
+
Exercise string
|
24
|
+
Version string
|
25
|
+
Cases []struct {
|
26
|
+
Description string
|
27
|
+
Cases []oneCase
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
// Test cases
|
32
|
+
type oneCase struct {
|
33
|
+
Description string
|
34
|
+
Property string
|
35
|
+
Input string
|
36
|
+
Expected bool
|
37
|
+
}
|
38
|
+
|
39
|
+
// Template to generate test cases.
|
40
|
+
var tmpl = `package isogram
|
41
|
+
|
42
|
+
{{.Header}}
|
43
|
+
|
44
|
+
var testCases = []struct {
|
45
|
+
description string
|
46
|
+
input string
|
47
|
+
expected bool
|
48
|
+
}{ {{range .J.Cases}} {{range .Cases}}
|
49
|
+
{
|
50
|
+
description: {{printf "%q" .Description}},
|
51
|
+
input: {{printf "%q" .Input}},
|
52
|
+
expected: {{printf "%t" .Expected}},
|
53
|
+
},{{end}}{{end}}
|
54
|
+
}
|
55
|
+
`
|
@@ -0,0 +1,57 @@
|
|
1
|
+
package isogram
|
2
|
+
|
3
|
+
// Source: exercism/problem-specifications
|
4
|
+
// Commit: f9e0ebb isogram: Update canonical-data.json as in #919 (#920)
|
5
|
+
// Problem Specifications Version: 1.2.0
|
6
|
+
|
7
|
+
var testCases = []struct {
|
8
|
+
description string
|
9
|
+
input string
|
10
|
+
expected bool
|
11
|
+
}{
|
12
|
+
{
|
13
|
+
description: "empty string",
|
14
|
+
input: "",
|
15
|
+
expected: true,
|
16
|
+
},
|
17
|
+
{
|
18
|
+
description: "isogram with only lower case characters",
|
19
|
+
input: "isogram",
|
20
|
+
expected: true,
|
21
|
+
},
|
22
|
+
{
|
23
|
+
description: "word with one duplicated character",
|
24
|
+
input: "eleven",
|
25
|
+
expected: false,
|
26
|
+
},
|
27
|
+
{
|
28
|
+
description: "longest reported english isogram",
|
29
|
+
input: "subdermatoglyphic",
|
30
|
+
expected: true,
|
31
|
+
},
|
32
|
+
{
|
33
|
+
description: "word with duplicated character in mixed case",
|
34
|
+
input: "Alphabet",
|
35
|
+
expected: false,
|
36
|
+
},
|
37
|
+
{
|
38
|
+
description: "hypothetical isogrammic word with hyphen",
|
39
|
+
input: "thumbscrew-japingly",
|
40
|
+
expected: true,
|
41
|
+
},
|
42
|
+
{
|
43
|
+
description: "isogram with duplicated hyphen",
|
44
|
+
input: "six-year-old",
|
45
|
+
expected: true,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
description: "made-up name that is an isogram",
|
49
|
+
input: "Emily Jung Schwartzkopf",
|
50
|
+
expected: true,
|
51
|
+
},
|
52
|
+
{
|
53
|
+
description: "duplicated character in the middle",
|
54
|
+
input: "accentor",
|
55
|
+
expected: false,
|
56
|
+
},
|
57
|
+
}
|
@@ -2,29 +2,13 @@ package isogram
|
|
2
2
|
|
3
3
|
import "testing"
|
4
4
|
|
5
|
-
var testCases = []struct {
|
6
|
-
word string
|
7
|
-
expected bool
|
8
|
-
}{
|
9
|
-
{"duplicates", true},
|
10
|
-
{"eleven", false},
|
11
|
-
{"subdermatoglyphic", true},
|
12
|
-
{"Alphabet", false},
|
13
|
-
{"thumbscrew-japingly", true},
|
14
|
-
{"Hjelmqvist-Gryb-Zock-Pfund-Wax", true},
|
15
|
-
{"Heizölrückstoßabdämpfung", true},
|
16
|
-
{"the quick brown fox", false},
|
17
|
-
{"Emily Jung Schwartzkopf", true},
|
18
|
-
{"éléphant", false},
|
19
|
-
}
|
20
|
-
|
21
5
|
func TestIsIsogram(t *testing.T) {
|
22
6
|
for _, c := range testCases {
|
23
|
-
if IsIsogram(c.
|
24
|
-
t.Fatalf("FAIL:
|
7
|
+
if IsIsogram(c.input) != c.expected {
|
8
|
+
t.Fatalf("FAIL: %s\nWord %q, expected %t, got %t", c.description, c.input, c.expected, !c.expected)
|
25
9
|
}
|
26
10
|
|
27
|
-
t.Logf("PASS: Word %q", c.
|
11
|
+
t.Logf("PASS: Word %q", c.input)
|
28
12
|
}
|
29
13
|
}
|
30
14
|
|
@@ -34,7 +18,7 @@ func BenchmarkIsIsogram(b *testing.B) {
|
|
34
18
|
b.StartTimer()
|
35
19
|
|
36
20
|
for i := 0; i < b.N; i++ {
|
37
|
-
IsIsogram(c.
|
21
|
+
IsIsogram(c.input)
|
38
22
|
}
|
39
23
|
|
40
24
|
b.StopTimer()
|
data/tracks/java/config.json
CHANGED
@@ -602,7 +602,13 @@
|
|
602
602
|
"core": false,
|
603
603
|
"difficulty": 6,
|
604
604
|
"slug": "house",
|
605
|
-
"topics":
|
605
|
+
"topics": [
|
606
|
+
"arrays",
|
607
|
+
"conditionals",
|
608
|
+
"loops",
|
609
|
+
"strings",
|
610
|
+
"text_formatting"
|
611
|
+
],
|
606
612
|
"unlocked_by": "two-fer",
|
607
613
|
"uuid": "6b51aca3-3451-4a64-ad7b-00b151d7548a"
|
608
614
|
},
|
@@ -66,10 +66,15 @@ public class LuhnValidatorTest {
|
|
66
66
|
assertFalse(luhnValidator.isValid("055-444-285"));
|
67
67
|
}
|
68
68
|
|
69
|
+
/* The following test diverges from the canonical test data. This is because the corresponding canonical test does
|
70
|
+
* not account for Java specific functions (such as Character.getNumericValue()), which can be part of incorrect yet
|
71
|
+
* passing implementations. For more detail, check out issue #972 here:
|
72
|
+
* (https://github.com/exercism/java/issues/972).
|
73
|
+
*/
|
69
74
|
@Ignore("Remove to run test")
|
70
75
|
@Test
|
71
76
|
public void testThatStringContainingSymbolsIsInvalid() {
|
72
|
-
assertFalse(luhnValidator.isValid("
|
77
|
+
assertFalse(luhnValidator.isValid("34&"));
|
73
78
|
}
|
74
79
|
|
75
80
|
@Ignore("Remove to run test")
|
@@ -1,6 +1,5 @@
|
|
1
1
|
big-integer.js
|
2
2
|
exercises/accumulate
|
3
|
-
exercises/acronym
|
4
3
|
exercises/alphametics
|
5
4
|
exercises/anagram
|
6
5
|
exercises/binary-search
|
@@ -10,7 +9,6 @@ exercises/bracket-push
|
|
10
9
|
exercises/circular-buffer
|
11
10
|
exercises/clock
|
12
11
|
exercises/custom-set
|
13
|
-
exercises/diamond
|
14
12
|
exercises/flatten-array
|
15
13
|
exercises/food-chain
|
16
14
|
exercises/grade-school
|
@@ -37,7 +35,6 @@ exercises/scrabble-score
|
|
37
35
|
exercises/secret-handshake
|
38
36
|
exercises/simple-cipher
|
39
37
|
exercises/simple-linked-list
|
40
|
-
exercises/sum-of-multiples
|
41
38
|
exercises/triangle
|
42
39
|
exercises/trinary
|
43
40
|
exercises/wordy
|
@@ -2,7 +2,8 @@ module.exports = {
|
|
2
2
|
parse: function (phrase) {
|
3
3
|
return phrase.match(/[A-Z]+[a-z]*|[a-z]+/g)
|
4
4
|
.reduce(function (acronym, word) {
|
5
|
-
|
5
|
+
var returnAcronym = acronym + word[0].toUpperCase();
|
6
|
+
return returnAcronym;
|
6
7
|
}, '');
|
7
8
|
}
|
8
9
|
};
|