trackler 2.1.0.26 → 2.1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +0 -15
- data/common/exercises/secret-handshake/canonical-data.json +14 -7
- data/lib/trackler/version.rb +1 -1
- data/tracks/dlang/config.json +18 -0
- data/tracks/dlang/exercises/leap/leap.d +8 -0
- data/tracks/dlang/exercises/leap/leap_example.d +15 -0
- data/tracks/dlang/exercises/react/react.d +211 -0
- data/tracks/dlang/exercises/react/react_example.d +291 -0
- data/tracks/factor/README.md +7 -7
- data/tracks/factor/config.json +13 -4
- data/tracks/factor/exercises/hello-world/hello-world-example.factor +2 -3
- data/tracks/factor/exercises/hello-world/hello-world-tests.factor +1 -5
- data/tracks/factor/exercises/hello-world/hello-world.factor +1 -1
- data/tracks/factor/exercises/two-fer/two-fer-example.factor +6 -0
- data/tracks/factor/exercises/two-fer/two-fer-tests.factor +8 -0
- data/tracks/fortran/Makefile +1 -2
- data/tracks/fortran/config.json +6 -0
- data/tracks/fortran/exercises/bob/bob.fun +18 -18
- data/tracks/fortran/exercises/hamming/example.f90 +25 -0
- data/tracks/fortran/exercises/hamming/hamming.fun +75 -0
- data/tracks/go/exercises/poker/.meta/gen.go +76 -0
- data/tracks/go/exercises/poker/cases_test.go +240 -0
- data/tracks/go/exercises/poker/example.go +10 -1
- data/tracks/go/exercises/poker/poker_test.go +1 -224
- data/tracks/go/exercises/sum-of-multiples/.meta/gen.go +43 -0
- data/tracks/go/exercises/sum-of-multiples/cases_test.go +24 -0
- data/tracks/go/exercises/sum-of-multiples/example.go +1 -1
- data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +1 -18
- data/tracks/groovy/exercises/robot-name/RobotSpec.groovy +38 -0
- data/tracks/kotlin/config.json +10 -0
- data/tracks/kotlin/exercises/collatz-conjecture/build.gradle +28 -0
- data/tracks/kotlin/exercises/collatz-conjecture/src/example/kotlin/CollatzCalculator.kt +12 -0
- data/tracks/kotlin/exercises/collatz-conjecture/src/main/kotlin/.keep +0 -0
- data/tracks/kotlin/exercises/collatz-conjecture/src/test/kotlin/CollatzCalculatorTest.kt +51 -0
- data/tracks/kotlin/exercises/diamond/build.gradle +28 -0
- data/tracks/kotlin/exercises/diamond/src/example/kotlin/DiamondPrinter.kt +35 -0
- data/tracks/kotlin/exercises/diamond/src/main/kotlin/DiamondPrinter.kt +5 -0
- data/tracks/kotlin/exercises/diamond/src/test/kotlin/DiamondPrinterTest.kt +121 -0
- data/tracks/kotlin/exercises/settings.gradle +2 -0
- data/tracks/ocaml/.gitignore +1 -0
- data/tracks/ocaml/.vscode/launch.json +14 -0
- data/tracks/ocaml/tools/test-generator/src/controller.ml +15 -16
- data/tracks/ocaml/tools/test-generator/src/languages.ml +30 -0
- data/tracks/ocaml/tools/test-generator/src/ocaml_special_cases.ml +137 -0
- data/tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml +13 -0
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +7 -132
- data/tracks/ocaml/tools/test-generator/src/template.ml +3 -3
- data/tracks/ocaml/tools/test-generator/src/test_gen.ml +13 -3
- data/tracks/ocaml/tools/test-generator/templates/{acronym → ocaml/acronym}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{all-your-base → ocaml/all-your-base}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{anagram → ocaml/anagram}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{atbash-cipher → ocaml/atbash-cipher}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{beer-song → ocaml/beer-song}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{binary-search → ocaml/binary-search}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{bob → ocaml/bob}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{bowling → ocaml/bowling}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{bracket-push → ocaml/bracket-push}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{change → ocaml/change}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{connect → ocaml/connect}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{difference-of-squares → ocaml/difference-of-squares}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{dominoes → ocaml/dominoes}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{etl → ocaml/etl}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{forth → ocaml/forth}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{hamming → ocaml/hamming}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{hello-world → ocaml/hello-world}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{leap → ocaml/leap}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{luhn → ocaml/luhn}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{minesweeper → ocaml/minesweeper}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{pangram → ocaml/pangram}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{phone-number → ocaml/phone-number}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{prime-factors → ocaml/prime-factors}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{raindrops → ocaml/raindrops}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{roman-numerals → ocaml/roman-numerals}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{run-length-encoding → ocaml/run-length-encoding}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{say → ocaml/say}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{space-age → ocaml/space-age}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{triangle → ocaml/triangle}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/{word-count → ocaml/word-count}/template.ml +0 -0
- data/tracks/ocaml/tools/test-generator/templates/purescript/hamming/Main.purs +18 -0
- data/tracks/ocaml/tools/test-generator/test/all_tests.ml +2 -2
- data/tracks/ocaml/tools/test-generator/test/{special_cases_test.ml → ocaml_special_cases_test.ml} +3 -3
- data/tracks/ocaml/tools/test-generator/test/template_test.ml +1 -0
- metadata +59 -34
- data/tracks/groovy/exercises/robot-name/RobotTest.groovy +0 -34
@@ -7,7 +7,7 @@ import (
|
|
7
7
|
"unicode/utf8"
|
8
8
|
)
|
9
9
|
|
10
|
-
const testVersion =
|
10
|
+
const testVersion = 5
|
11
11
|
|
12
12
|
const (
|
13
13
|
Jack = 11
|
@@ -168,6 +168,15 @@ func evalHand(counts []rankCount, cards []card) handValue {
|
|
168
168
|
discrs = append(discrs, card.rank)
|
169
169
|
}
|
170
170
|
sort.Sort(sort.Reverse(sort.IntSlice(discrs)))
|
171
|
+
} else if (kind == straight || kind == straightFlush) &&
|
172
|
+
counts[0].rank == Ace && counts[1].rank == 5 {
|
173
|
+
// For a straight with an Ace through 5,
|
174
|
+
// adjust down the discrs value of the Ace to be 1.
|
175
|
+
for i := 1; i < len(cards); i++ {
|
176
|
+
discrs = append(discrs, counts[i].rank)
|
177
|
+
}
|
178
|
+
// Ace becomes a 1 in a low straight with Ace.
|
179
|
+
discrs = append(discrs, 1)
|
171
180
|
} else {
|
172
181
|
for _, rc := range counts {
|
173
182
|
discrs = append(discrs, rc.rank)
|
@@ -10,230 +10,7 @@ import (
|
|
10
10
|
// Also define a testVersion with a value that matches
|
11
11
|
// the targetTestVersion here.
|
12
12
|
|
13
|
-
const targetTestVersion =
|
14
|
-
|
15
|
-
var validTestCases = []struct {
|
16
|
-
name string
|
17
|
-
hands []string
|
18
|
-
best []string
|
19
|
-
}{
|
20
|
-
{
|
21
|
-
name: "single hand is always best",
|
22
|
-
hands: []string{"3♡ 10♢ 7♧ 8♤ A♢"},
|
23
|
-
best: []string{"3♡ 10♢ 7♧ 8♤ A♢"},
|
24
|
-
},
|
25
|
-
{
|
26
|
-
name: "highest card",
|
27
|
-
hands: []string{"3♢ 2♢ 5♤ 6♤ 9♡", "3♡ 2♡ 5♧ 6♢ 10♡"},
|
28
|
-
best: []string{"3♡ 2♡ 5♧ 6♢ 10♡"},
|
29
|
-
},
|
30
|
-
{
|
31
|
-
name: "highest card with mostly same cards",
|
32
|
-
hands: []string{"4♢ 2♢ 5♤ 6♤ 9♡", "4♡ 3♤ 5♧ 6♢ 9♢"},
|
33
|
-
best: []string{"4♡ 3♤ 5♧ 6♢ 9♢"},
|
34
|
-
},
|
35
|
-
{
|
36
|
-
name: "pair beats lower",
|
37
|
-
hands: []string{"4♢ 3♤ 4♤ J♤ K♤", "A♡ K♡ J♢ 10♧ 9♡"},
|
38
|
-
best: []string{"4♢ 3♤ 4♤ J♤ K♤"},
|
39
|
-
},
|
40
|
-
{
|
41
|
-
name: "best pair",
|
42
|
-
hands: []string{"4♡ 2♡ 5♧ 4♢ 10♡", "3♢ 3♡ 5♤ 6♤ 9♡"},
|
43
|
-
best: []string{"4♡ 2♡ 5♧ 4♢ 10♡"},
|
44
|
-
},
|
45
|
-
{
|
46
|
-
name: "best pair with same pair and highest cards",
|
47
|
-
hands: []string{"4♡ 2♡ 5♧ 4♢ 10♡", "4♤ 4♧ 5♡ 10♢ 3♡"},
|
48
|
-
best: []string{"4♤ 4♧ 5♡ 10♢ 3♡"},
|
49
|
-
},
|
50
|
-
{
|
51
|
-
name: "two pair beats lower",
|
52
|
-
hands: []string{
|
53
|
-
"4♢ 3♤ 4♤ J♤ K♤",
|
54
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
55
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
56
|
-
},
|
57
|
-
best: []string{"2♢ 8♡ 5♢ 2♡ 8♧"},
|
58
|
-
},
|
59
|
-
{
|
60
|
-
name: "best two pair",
|
61
|
-
hands: []string{
|
62
|
-
"4♢ J♧ 4♤ J♤ K♤",
|
63
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
64
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
65
|
-
},
|
66
|
-
best: []string{"4♢ J♧ 4♤ J♤ K♤"},
|
67
|
-
},
|
68
|
-
{
|
69
|
-
name: "best two pair with equal highest pair",
|
70
|
-
hands: []string{
|
71
|
-
"4♢ J♧ 4♤ J♤ K♤",
|
72
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
73
|
-
"3♢ J♡ 5♢ 3♡ J♢",
|
74
|
-
},
|
75
|
-
best: []string{"4♢ J♧ 4♤ J♤ K♤"},
|
76
|
-
},
|
77
|
-
{
|
78
|
-
name: "best two pair with equal pairs",
|
79
|
-
hands: []string{
|
80
|
-
"4♢ J♧ 4♤ J♤ 2♤",
|
81
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
82
|
-
"4♧ J♡ 5♢ 4♡ J♢",
|
83
|
-
},
|
84
|
-
best: []string{"4♧ J♡ 5♢ 4♡ J♢"},
|
85
|
-
},
|
86
|
-
{
|
87
|
-
name: "three of a kind beats lower",
|
88
|
-
hands: []string{
|
89
|
-
"4♢ 3♤ 4♤ J♤ K♤",
|
90
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
91
|
-
"3♢ 8♡ 3♡ 3♧ 9♧",
|
92
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
93
|
-
},
|
94
|
-
best: []string{"3♢ 8♡ 3♡ 3♧ 9♧"},
|
95
|
-
},
|
96
|
-
{
|
97
|
-
name: "best three of a kind",
|
98
|
-
hands: []string{
|
99
|
-
"4♢ 3♤ 4♤ J♤ 4♡",
|
100
|
-
"A♡ K♡ J♢ 10♧ 9♡",
|
101
|
-
"3♢ 8♡ 3♡ 3♧ 9♧",
|
102
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
103
|
-
},
|
104
|
-
best: []string{"4♢ 3♤ 4♤ J♤ 4♡"},
|
105
|
-
},
|
106
|
-
{
|
107
|
-
name: "straight beats lower",
|
108
|
-
hands: []string{
|
109
|
-
"4♢ 3♤ 4♤ J♤ K♤",
|
110
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
111
|
-
"3♢ 8♡ 3♡ 3♧ 9♧",
|
112
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
113
|
-
},
|
114
|
-
best: []string{"Q♡ K♡ J♢ 10♧ 9♡"},
|
115
|
-
},
|
116
|
-
{
|
117
|
-
name: "straight includes ace as one",
|
118
|
-
hands: []string{
|
119
|
-
"4♢ 3♤ 4♤ J♤ K♤",
|
120
|
-
"2♤ 3♡ A♤ 5♤ 4♤",
|
121
|
-
"3♢ 8♡ 3♡ 3♧ 9♧",
|
122
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
123
|
-
},
|
124
|
-
best: []string{"2♤ 3♡ A♤ 5♤ 4♤"},
|
125
|
-
},
|
126
|
-
{
|
127
|
-
name: "best straight",
|
128
|
-
hands: []string{
|
129
|
-
"4♢ 3♤ 4♤ J♤ K♤",
|
130
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
131
|
-
"A♢ K♧ 10♢ J♢ Q♢",
|
132
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
133
|
-
},
|
134
|
-
best: []string{"A♢ K♧ 10♢ J♢ Q♢"},
|
135
|
-
},
|
136
|
-
{
|
137
|
-
name: "flush beats lower",
|
138
|
-
hands: []string{
|
139
|
-
"4♤ 3♤ 8♤ J♤ K♤",
|
140
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
141
|
-
"3♢ 8♡ 3♡ 3♧ 9♧",
|
142
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
143
|
-
},
|
144
|
-
best: []string{"4♤ 3♤ 8♤ J♤ K♤"},
|
145
|
-
},
|
146
|
-
{
|
147
|
-
name: "best flush",
|
148
|
-
hands: []string{
|
149
|
-
"4♤ 3♤ 8♤ J♤ K♤",
|
150
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
151
|
-
"3♢ 8♢ A♢ 4♢ 7♢",
|
152
|
-
"2♢ 8♡ 5♢ 2♡ 8♧",
|
153
|
-
},
|
154
|
-
best: []string{"3♢ 8♢ A♢ 4♢ 7♢"},
|
155
|
-
},
|
156
|
-
{
|
157
|
-
name: "full house beats lower",
|
158
|
-
hands: []string{
|
159
|
-
"4♤ 3♤ 8♤ J♤ K♤",
|
160
|
-
"2♢ 8♡ 8♢ 2♡ 8♧",
|
161
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
162
|
-
"3♢ A♡ 3♡ 3♧ A♧",
|
163
|
-
},
|
164
|
-
best: []string{"2♢ 8♡ 8♢ 2♡ 8♧"},
|
165
|
-
},
|
166
|
-
{
|
167
|
-
name: "best full house",
|
168
|
-
hands: []string{
|
169
|
-
"4♤ 3♤ 8♤ J♤ K♤",
|
170
|
-
"2♢ 8♡ 8♢ 2♡ 8♧",
|
171
|
-
"5♡ 5♢ A♧ 5♧ A♢",
|
172
|
-
"3♢ A♡ 3♡ 3♧ A♧",
|
173
|
-
},
|
174
|
-
best: []string{"2♢ 8♡ 8♢ 2♡ 8♧"},
|
175
|
-
},
|
176
|
-
{
|
177
|
-
name: "four of a kind beats lower",
|
178
|
-
hands: []string{
|
179
|
-
"4♤ 5♤ 8♤ J♤ K♤",
|
180
|
-
"2♢ 8♡ 8♢ 2♡ 8♧",
|
181
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
182
|
-
"3♢ 3♡ 3♤ 3♧ A♧",
|
183
|
-
},
|
184
|
-
best: []string{"3♢ 3♡ 3♤ 3♧ A♧"},
|
185
|
-
},
|
186
|
-
{
|
187
|
-
name: "best four of a kind",
|
188
|
-
hands: []string{
|
189
|
-
"4♤ 5♤ 8♤ J♤ K♤",
|
190
|
-
"2♢ 2♧ 8♢ 2♡ 2♤",
|
191
|
-
"Q♡ K♡ J♢ 10♧ 9♡",
|
192
|
-
"3♢ 3♡ 3♤ 3♧ A♧",
|
193
|
-
},
|
194
|
-
best: []string{"3♢ 3♡ 3♤ 3♧ A♧"},
|
195
|
-
},
|
196
|
-
{
|
197
|
-
name: "straight flush beats lower",
|
198
|
-
hands: []string{
|
199
|
-
"4♤ 5♢ 8♤ J♤ K♤",
|
200
|
-
"2♢ 8♡ 8♢ 2♡ 8♧",
|
201
|
-
"Q♡ K♡ 8♡ 10♡ 9♡",
|
202
|
-
"3♢ 3♡ 3♤ 3♧ A♧",
|
203
|
-
"2♤ 3♤ A♤ 5♤ 4♤",
|
204
|
-
},
|
205
|
-
best: []string{"2♤ 3♤ A♤ 5♤ 4♤"},
|
206
|
-
},
|
207
|
-
{
|
208
|
-
name: "best straight flush is royal flush",
|
209
|
-
hands: []string{
|
210
|
-
"4♤ 5♤ 8♤ J♤ K♤",
|
211
|
-
"2♢ 8♡ 8♢ 2♡ 8♧",
|
212
|
-
"Q♡ K♡ J♡ 10♡ 9♡",
|
213
|
-
"Q♢ K♢ J♢ 10♢ A♢",
|
214
|
-
},
|
215
|
-
best: []string{"Q♢ K♢ J♢ 10♢ A♢"},
|
216
|
-
},
|
217
|
-
{
|
218
|
-
name: "tie for best pair",
|
219
|
-
hands: []string{"4♡ 2♡ 5♧ 4♢ 10♡", "4♧ 10♢ 5♤ 2♤ 4♤"},
|
220
|
-
best: []string{"4♡ 2♡ 5♧ 4♢ 10♡", "4♧ 10♢ 5♤ 2♤ 4♤"},
|
221
|
-
},
|
222
|
-
{
|
223
|
-
name: "tie of three",
|
224
|
-
hands: []string{
|
225
|
-
"A♡ 2♡ 3♡ 4♡ 5♡",
|
226
|
-
"A♤ 2♤ 3♤ 4♤ 5♤",
|
227
|
-
"5♧ 4♧ 3♧ 2♧ A♧",
|
228
|
-
"A♢ 2♢ 6♢ 4♢ 5♢",
|
229
|
-
},
|
230
|
-
best: []string{
|
231
|
-
"A♡ 2♡ 3♡ 4♡ 5♡",
|
232
|
-
"A♤ 2♤ 3♤ 4♤ 5♤",
|
233
|
-
"5♧ 4♧ 3♧ 2♧ A♧",
|
234
|
-
},
|
235
|
-
},
|
236
|
-
}
|
13
|
+
const targetTestVersion = 5
|
237
14
|
|
238
15
|
var invalidTestCases = []struct {
|
239
16
|
name string
|
@@ -0,0 +1,43 @@
|
|
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("sum-of-multiples", &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
|
+
Cases []struct {
|
24
|
+
Description string
|
25
|
+
Factors []int
|
26
|
+
Limit int
|
27
|
+
Expected int
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
// template applied to above data structure generates the Go test cases
|
32
|
+
var tmpl = `package summultiples
|
33
|
+
|
34
|
+
{{.Header}}
|
35
|
+
|
36
|
+
var varTests = []struct {
|
37
|
+
divisors []int
|
38
|
+
limit int
|
39
|
+
sum int
|
40
|
+
}{
|
41
|
+
{{range .J.Cases}}{ {{.Factors | printf "%#v"}}, {{.Limit}}, {{.Expected}}}, // {{.Description}}
|
42
|
+
{{end}}}
|
43
|
+
`
|
@@ -0,0 +1,24 @@
|
|
1
|
+
package summultiples
|
2
|
+
|
3
|
+
// Source: exercism/x-common
|
4
|
+
// Commit: 72b1496 sum-of-multiples: Fix canonical-data.json formatting
|
5
|
+
// x-common version: 1.0.0
|
6
|
+
|
7
|
+
var varTests = []struct {
|
8
|
+
divisors []int
|
9
|
+
limit int
|
10
|
+
sum int
|
11
|
+
}{
|
12
|
+
{[]int{3, 5}, 1, 0}, // multiples of 3 or 5 up to 1
|
13
|
+
{[]int{3, 5}, 4, 3}, // multiples of 3 or 5 up to 4
|
14
|
+
{[]int{3, 5}, 10, 23}, // multiples of 3 or 5 up to 10
|
15
|
+
{[]int{3, 5}, 100, 2318}, // multiples of 3 or 5 up to 100
|
16
|
+
{[]int{3, 5}, 1000, 233168}, // multiples of 3 or 5 up to 1000
|
17
|
+
{[]int{7, 13, 17}, 20, 51}, // multiples of 7, 13 or 17 up to 20
|
18
|
+
{[]int{4, 6}, 15, 30}, // multiples of 4 or 6 up to 15
|
19
|
+
{[]int{5, 6, 8}, 150, 4419}, // multiples of 5, 6 or 8 up to 150
|
20
|
+
{[]int{5, 25}, 51, 275}, // multiples of 5 or 25 up to 51
|
21
|
+
{[]int{43, 47}, 10000, 2203160}, // multiples of 43 or 47 up to 10000
|
22
|
+
{[]int{1}, 100, 4950}, // multiples of 1 up to 100
|
23
|
+
{[]int{}, 10000, 0}, // multiples of an empty list up to 10000
|
24
|
+
}
|
@@ -2,24 +2,7 @@ package summultiples
|
|
2
2
|
|
3
3
|
import "testing"
|
4
4
|
|
5
|
-
const targetTestVersion =
|
6
|
-
|
7
|
-
var varTests = []struct {
|
8
|
-
divisors []int
|
9
|
-
limit int
|
10
|
-
sum int
|
11
|
-
}{
|
12
|
-
{[]int{3, 5}, 1, 0},
|
13
|
-
{[]int{3, 5}, 4, 3},
|
14
|
-
{[]int{3, 5}, 10, 23},
|
15
|
-
{[]int{3, 5}, 100, 2318},
|
16
|
-
{[]int{3, 5}, 1000, 233168},
|
17
|
-
{[]int{7, 13, 17}, 20, 51},
|
18
|
-
{[]int{43, 47}, 10000, 2203160},
|
19
|
-
{[]int{5, 10, 12}, 10000, 13331672},
|
20
|
-
{[]int{1, 1}, 10000, 49995000},
|
21
|
-
{[]int{}, 10000, 0},
|
22
|
-
}
|
5
|
+
const targetTestVersion = 2
|
23
6
|
|
24
7
|
func TestTestVersion(t *testing.T) {
|
25
8
|
if testVersion != targetTestVersion {
|
@@ -0,0 +1,38 @@
|
|
1
|
+
@Grab('org.spockframework:spock-core:1.0-groovy-2.4')
|
2
|
+
import spock.lang.*
|
3
|
+
|
4
|
+
class RobotSpec extends Specification {
|
5
|
+
|
6
|
+
def 'generates a name'() {
|
7
|
+
expect: new Robot().name =~ /^[a-zA-Z]{2}\d{3}$/
|
8
|
+
}
|
9
|
+
|
10
|
+
@Ignore
|
11
|
+
def 'generates the same name when called again'() {
|
12
|
+
given:
|
13
|
+
def robot = new Robot()
|
14
|
+
expect:
|
15
|
+
robot.name == robot.name
|
16
|
+
}
|
17
|
+
|
18
|
+
@Ignore
|
19
|
+
def 'different robots generate different names'() {
|
20
|
+
given:
|
21
|
+
def robot = new Robot()
|
22
|
+
def other_robot = new Robot()
|
23
|
+
expect:
|
24
|
+
robot.name != other_robot.name
|
25
|
+
}
|
26
|
+
|
27
|
+
@Ignore
|
28
|
+
def 'can be reset to generate another name'() {
|
29
|
+
given:
|
30
|
+
def robot = new Robot()
|
31
|
+
def name_before_reset = robot.name
|
32
|
+
robot.reset()
|
33
|
+
def name_after_reset = robot.name
|
34
|
+
expect:
|
35
|
+
name_before_reset != name_after_reset
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
data/tracks/kotlin/config.json
CHANGED
@@ -252,6 +252,16 @@
|
|
252
252
|
"slug": "all-your-base",
|
253
253
|
"topics": []
|
254
254
|
},
|
255
|
+
{
|
256
|
+
"difficulty": 1,
|
257
|
+
"slug": "collatz-conjecture",
|
258
|
+
"topics": []
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"difficulty": 1,
|
262
|
+
"slug": "diamond",
|
263
|
+
"topics": []
|
264
|
+
},
|
255
265
|
{
|
256
266
|
"difficulty": 2,
|
257
267
|
"slug": "bank-account",
|
@@ -0,0 +1,28 @@
|
|
1
|
+
buildscript {
|
2
|
+
ext.kotlin_version = '1.1.1'
|
3
|
+
repositories {
|
4
|
+
mavenCentral()
|
5
|
+
}
|
6
|
+
dependencies {
|
7
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
apply plugin: 'kotlin'
|
12
|
+
|
13
|
+
repositories {
|
14
|
+
mavenCentral()
|
15
|
+
}
|
16
|
+
|
17
|
+
dependencies {
|
18
|
+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
19
|
+
|
20
|
+
testCompile 'junit:junit:4.12'
|
21
|
+
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
|
22
|
+
}
|
23
|
+
test {
|
24
|
+
testLogging {
|
25
|
+
exceptionFormat = 'full'
|
26
|
+
events = ["passed", "failed", "skipped"]
|
27
|
+
}
|
28
|
+
}
|