trackler 2.2.1.101 → 2.2.1.102
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/protein-translation/description.md +2 -2
- data/problem-specifications/exercises/robot-simulator/canonical-data.json +27 -27
- data/problem-specifications/exercises/run-length-encoding/canonical-data.json +40 -14
- data/problem-specifications/exercises/tournament/canonical-data.json +71 -49
- data/tracks/bash/CONTRIBUTING.md +5 -10
- data/tracks/bash/POLICIES.md +57 -0
- data/tracks/bash/_template/example.sh +20 -1
- data/tracks/bash/exercises/hello-world/hello_world.sh +22 -0
- data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +1 -9
- data/tracks/ceylon/exercises/rna-transcription/README.md +1 -1
- data/tracks/fsharp/exercises/matrix/Example.fs +16 -13
- data/tracks/fsharp/exercises/matrix/Matrix.fs +2 -4
- data/tracks/fsharp/exercises/matrix/MatrixTest.fs +26 -67
- data/tracks/fsharp/exercises/saddle-points/Example.fs +19 -15
- data/tracks/fsharp/exercises/saddle-points/SaddlePointsTest.fs +31 -31
- data/tracks/fsharp/exercises/sublist/SublistTest.fs +71 -41
- data/tracks/fsharp/exercises/tournament/TournamentTest.fs +115 -48
- data/tracks/fsharp/exercises/transpose/Example.fs +10 -13
- data/tracks/fsharp/exercises/transpose/TransposeTest.fs +150 -219
- data/tracks/fsharp/generators/Generators.fs +55 -0
- data/tracks/go/exercises/clock/clock_test.go +1 -1
- data/tracks/go/exercises/poker/.meta/gen.go +5 -3
- data/tracks/go/exercises/poker/cases_test.go +2 -2
- data/tracks/go/exercises/prime-factors/.meta/gen.go +5 -3
- data/tracks/go/exercises/prime-factors/cases_test.go +2 -2
- data/tracks/go/exercises/rail-fence-cipher/.meta/gen.go +9 -7
- data/tracks/go/exercises/rail-fence-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/raindrops/.meta/gen.go +4 -2
- data/tracks/go/exercises/raindrops/cases_test.go +2 -2
- data/tracks/go/exercises/reverse-string/.meta/gen.go +5 -3
- data/tracks/go/exercises/reverse-string/cases_test.go +2 -2
- data/tracks/go/exercises/rna-transcription/.meta/gen.go +11 -19
- data/tracks/go/exercises/rna-transcription/cases_test.go +20 -18
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +3 -2
- data/tracks/go/exercises/run-length-encoding/.meta/gen.go +15 -9
- data/tracks/go/exercises/run-length-encoding/cases_test.go +2 -2
- data/tracks/go/exercises/sieve/.meta/gen.go +5 -3
- data/tracks/go/exercises/sieve/cases_test.go +2 -2
- data/tracks/go/exercises/space-age/.meta/gen.go +7 -5
- data/tracks/go/exercises/space-age/cases_test.go +2 -2
- data/tracks/go/exercises/sublist/.meta/gen.go +7 -5
- data/tracks/go/exercises/sublist/cases_test.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/.meta/gen.go +7 -5
- data/tracks/go/exercises/variable-length-quantity/cases_test.go +2 -2
- data/tracks/haskell/exercises/rna-transcription/README.md +1 -1
- data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/test/Tests.hs +12 -0
- data/tracks/javascript/.travis.yml +1 -1
- data/tracks/ruby/exercises/accumulate/.meta/hints.md +6 -3
- data/tracks/ruby/exercises/accumulate/README.md +6 -3
- metadata +4 -3
- data/tracks/fsharp/exercises/transpose/TrinaryTest.fs +0 -26
@@ -609,6 +609,9 @@ type Markdown() =
|
|
609
609
|
{ base.ToTestMethod (index, canonicalDataCase) with Skip = false }
|
610
610
|
|
611
611
|
override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
|
612
|
+
|
613
|
+
type Matrix() =
|
614
|
+
inherit GeneratorExercise()
|
612
615
|
|
613
616
|
type Meetup() =
|
614
617
|
inherit GeneratorExercise()
|
@@ -1125,6 +1128,25 @@ type RunLengthEncoding() =
|
|
1125
1128
|
type RomanNumerals() =
|
1126
1129
|
inherit GeneratorExercise()
|
1127
1130
|
|
1131
|
+
type SaddlePoints() =
|
1132
|
+
inherit GeneratorExercise()
|
1133
|
+
|
1134
|
+
let renderSaddlePoint (input: JObject) =
|
1135
|
+
(input.Value<int>("row"), input.Value<int>("column")) |> formatTuple
|
1136
|
+
|
1137
|
+
override __.RenderInput (_, _, value) =
|
1138
|
+
value :?> JArray
|
1139
|
+
|> normalizeJArray
|
1140
|
+
|> Seq.map formatValue
|
1141
|
+
|> formatMultiLineList
|
1142
|
+
|
1143
|
+
override __.RenderExpected (_, _, value) =
|
1144
|
+
(value :?> JArray).Values<JObject>()
|
1145
|
+
|> Seq.map renderSaddlePoint
|
1146
|
+
|> formatList
|
1147
|
+
|
1148
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.PropertiesUsedAsSutParameter canonicalDataCase
|
1149
|
+
|
1128
1150
|
type Say() =
|
1129
1151
|
inherit GeneratorExercise()
|
1130
1152
|
|
@@ -1168,9 +1190,27 @@ type SpiralMatrix() =
|
|
1168
1190
|
|> Seq.map formatValue
|
1169
1191
|
|> formatMultiLineList
|
1170
1192
|
|
1193
|
+
type Sublist() =
|
1194
|
+
inherit GeneratorExercise()
|
1195
|
+
|
1196
|
+
override __.RenderExpected (_, _, value) =
|
1197
|
+
string value |> String.upperCaseFirst
|
1198
|
+
|
1199
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.PropertiesUsedAsSutParameter canonicalDataCase
|
1200
|
+
|
1171
1201
|
type SumOfMultiples() =
|
1172
1202
|
inherit GeneratorExercise()
|
1173
1203
|
|
1204
|
+
type Tournament() =
|
1205
|
+
inherit GeneratorExercise()
|
1206
|
+
|
1207
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
|
1208
|
+
|
1209
|
+
override __.RenderValue (_, _, value) =
|
1210
|
+
value :?> JArray
|
1211
|
+
|> Seq.map formatValue
|
1212
|
+
|> formatMultiLineList
|
1213
|
+
|
1174
1214
|
type TwelveDays() =
|
1175
1215
|
inherit GeneratorExercise()
|
1176
1216
|
|
@@ -1183,6 +1223,21 @@ type TwelveDays() =
|
|
1183
1223
|
|> Seq.map formatValue
|
1184
1224
|
|> formatMultiLineList
|
1185
1225
|
|
1226
|
+
type Transpose() =
|
1227
|
+
inherit GeneratorExercise()
|
1228
|
+
|
1229
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
|
1230
|
+
|
1231
|
+
override __.IdentifierTypeAnnotation (_, _, value) =
|
1232
|
+
match value :?> JArray |> Seq.isEmpty with
|
1233
|
+
| true -> Some "string list"
|
1234
|
+
| false -> None
|
1235
|
+
|
1236
|
+
override __.RenderValue (_, _, value) =
|
1237
|
+
value :?> JArray
|
1238
|
+
|> Seq.map formatValue
|
1239
|
+
|> formatMultiLineList
|
1240
|
+
|
1186
1241
|
type Triangle() =
|
1187
1242
|
inherit GeneratorExercise()
|
1188
1243
|
|
@@ -50,7 +50,7 @@ func TestAddMinutes(t *testing.T) {
|
|
50
50
|
func TestSubtractMinutes(t *testing.T) {
|
51
51
|
for _, a := range subtractTests {
|
52
52
|
if got := New(a.h, a.m).Subtract(a.a); got.String() != a.want {
|
53
|
-
t.Fatalf("New(%d, %d).
|
53
|
+
t.Fatalf("New(%d, %d).Subtract(%d) = %q, want %q",
|
54
54
|
a.h, a.m, a.a, got, a.want)
|
55
55
|
}
|
56
56
|
}
|
@@ -26,8 +26,10 @@ func main() {
|
|
26
26
|
type js struct {
|
27
27
|
Cases []struct {
|
28
28
|
Description string
|
29
|
-
Input
|
30
|
-
|
29
|
+
Input struct {
|
30
|
+
Hands []string
|
31
|
+
}
|
32
|
+
Expected []string
|
31
33
|
}
|
32
34
|
}
|
33
35
|
|
@@ -68,7 +70,7 @@ var validTestCases = []validTestCase {
|
|
68
70
|
{{range .J.Cases}}{
|
69
71
|
name: "{{.Description}}",
|
70
72
|
hands: []string{
|
71
|
-
{{range pokerHands .Input}} {{printf "%q" .}},
|
73
|
+
{{range pokerHands .Input.Hands}} {{printf "%q" .}},
|
72
74
|
{{end}} },
|
73
75
|
best: {{pokerHands .Expected | printf "%#v"}},
|
74
76
|
},
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package poker
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.
|
4
|
+
// Commit: 8e97630 poker: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
type validTestCase struct {
|
8
8
|
name string
|
@@ -30,8 +30,10 @@ type TestGroup struct {
|
|
30
30
|
|
31
31
|
type OneCase struct {
|
32
32
|
Description string
|
33
|
-
Input
|
34
|
-
|
33
|
+
Input struct {
|
34
|
+
Value int64
|
35
|
+
}
|
36
|
+
Expected []int64
|
35
37
|
}
|
36
38
|
|
37
39
|
// template applied to above data structure generates the Go test cases
|
@@ -47,7 +49,7 @@ var tests = []struct {
|
|
47
49
|
{{range .J.Groups}}
|
48
50
|
{{range .Cases}} {
|
49
51
|
"{{.Description}}",
|
50
|
-
{{.Input}},
|
52
|
+
{{.Input.Value}},
|
51
53
|
{{printf "%#v" .Expected}},
|
52
54
|
},
|
53
55
|
{{end}}{{end}}}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package prime
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.
|
4
|
+
// Commit: d928874 prime-factors: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
var tests = []struct {
|
8
8
|
description string
|
@@ -35,9 +35,11 @@ type testGroup struct {
|
|
35
35
|
type oneCase struct {
|
36
36
|
Description string
|
37
37
|
Property string
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
Input struct {
|
39
|
+
Message string `json:"msg"`
|
40
|
+
Rails int
|
41
|
+
}
|
42
|
+
Expected string
|
41
43
|
}
|
42
44
|
|
43
45
|
// Template to generate test cases.
|
@@ -59,8 +61,8 @@ type testCase struct {
|
|
59
61
|
{{- range .EncodeCases }}
|
60
62
|
|
61
63
|
{ {{.Description | printf "%q"}},
|
62
|
-
{{.Message | printf "%q"}},
|
63
|
-
{{.Rails}},
|
64
|
+
{{.Input.Message | printf "%q"}},
|
65
|
+
{{.Input.Rails}},
|
64
66
|
{{.Expected | printf "%q"}}},
|
65
67
|
{{- end }}
|
66
68
|
}
|
@@ -71,8 +73,8 @@ type testCase struct {
|
|
71
73
|
{{- range .DecodeCases }}
|
72
74
|
|
73
75
|
{ {{.Description | printf "%q"}},
|
74
|
-
{{.Message | printf "%q"}},
|
75
|
-
{{.Rails}},
|
76
|
+
{{.Input.Message | printf "%q"}},
|
77
|
+
{{.Input.Rails}},
|
76
78
|
{{.Expected | printf "%q"}}},
|
77
79
|
{{- end }}
|
78
80
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package railfence
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.0
|
4
|
+
// Commit: 88db37b rail-fence-cipher: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
type testCase struct {
|
8
8
|
description string
|
@@ -21,7 +21,9 @@ func main() {
|
|
21
21
|
// The JSON structure we expect to be able to unmarshal into
|
22
22
|
type js struct {
|
23
23
|
Cases []struct {
|
24
|
-
|
24
|
+
Input struct {
|
25
|
+
Number int
|
26
|
+
}
|
25
27
|
Expected string
|
26
28
|
}
|
27
29
|
}
|
@@ -35,6 +37,6 @@ var tests = []struct {
|
|
35
37
|
input int
|
36
38
|
expected string
|
37
39
|
}{
|
38
|
-
{{range .J.Cases}}{ {{.Number}}, "{{.Expected}}"},
|
40
|
+
{{range .J.Cases}}{ {{.Input.Number}}, "{{.Expected}}"},
|
39
41
|
{{end}}}
|
40
42
|
`
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package raindrops
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.
|
4
|
+
// Commit: 99de15d raindrops: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
var tests = []struct {
|
8
8
|
input int
|
@@ -29,8 +29,10 @@ type js struct {
|
|
29
29
|
type oneCase struct {
|
30
30
|
Description string
|
31
31
|
Property string
|
32
|
-
Input
|
33
|
-
|
32
|
+
Input struct {
|
33
|
+
Value string
|
34
|
+
}
|
35
|
+
Expected string
|
34
36
|
}
|
35
37
|
|
36
38
|
// Template to generate test cases.
|
@@ -45,7 +47,7 @@ var testCases = []struct {
|
|
45
47
|
}{ {{range .J.Cases}}
|
46
48
|
{
|
47
49
|
description: {{printf "%q" .Description}},
|
48
|
-
input: {{printf "%q" .Input}},
|
50
|
+
input: {{printf "%q" .Input.Value}},
|
49
51
|
expected: {{printf "%q" .Expected}},
|
50
52
|
},{{end}}
|
51
53
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package reverse
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.0
|
4
|
+
// Commit: 2f77985 reverse-string: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
var testCases = []struct {
|
8
8
|
description string
|
@@ -22,33 +22,25 @@ func main() {
|
|
22
22
|
type js struct {
|
23
23
|
Cases []struct {
|
24
24
|
Description string
|
25
|
-
|
26
|
-
|
25
|
+
Input struct {
|
26
|
+
Dna string
|
27
|
+
}
|
28
|
+
Expected string
|
27
29
|
}
|
28
30
|
}
|
29
31
|
|
30
32
|
// Template applied to above data structure generates the Go test cases.
|
31
|
-
//
|
32
|
-
// Note x-common test cases have some test cases that are not used here.
|
33
|
-
//
|
34
|
-
// It has some with invalid DNA inputs indicated with null expected values.
|
35
|
-
// The current API does not have an error or ok return. It could be changed
|
36
|
-
// but it's simple for now, leaving the result undefined for invalid input.
|
37
|
-
// So these test cases are skipped here.
|
38
|
-
//
|
39
|
-
// Also the x-common test cases include some test cases in the reverse
|
40
|
-
// direction, from rna to dna. These are not called for by the exercise
|
41
|
-
// readme and have no biological basis and so are not converted here.
|
42
33
|
var tmpl = `package strand
|
43
34
|
|
44
35
|
{{.Header}}
|
45
36
|
|
46
37
|
var rnaTests = []struct {
|
47
|
-
|
48
|
-
|
38
|
+
description string
|
39
|
+
input string
|
40
|
+
expected string
|
49
41
|
}{
|
50
|
-
{{range .J.Cases}}
|
51
|
-
|
52
|
-
|
53
|
-
{{end}}
|
42
|
+
{{range .J.Cases}}{ "{{.Description}}",
|
43
|
+
"{{.Input.Dna}}", "{{.Expected}}",
|
44
|
+
},
|
45
|
+
{{end}}}
|
54
46
|
`
|
@@ -1,25 +1,27 @@
|
|
1
1
|
package strand
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.0
|
4
|
+
// Commit: b4c24e6 rna-transcription: Apply new "input" policy
|
5
|
+
// Problem Specifications Version: 1.2.0
|
6
6
|
|
7
7
|
var rnaTests = []struct {
|
8
|
-
|
9
|
-
|
8
|
+
description string
|
9
|
+
input string
|
10
|
+
expected string
|
10
11
|
}{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
{"RNA complement of cytosine is guanine",
|
13
|
+
"C", "G",
|
14
|
+
},
|
15
|
+
{"RNA complement of guanine is cytosine",
|
16
|
+
"G", "C",
|
17
|
+
},
|
18
|
+
{"RNA complement of thymine is adenine",
|
19
|
+
"T", "A",
|
20
|
+
},
|
21
|
+
{"RNA complement of adenine is uracil",
|
22
|
+
"A", "U",
|
23
|
+
},
|
24
|
+
{"RNA complement",
|
25
|
+
"ACGTGGTCTTAA", "UGCACCAGAAUU",
|
26
|
+
},
|
25
27
|
}
|
@@ -5,9 +5,10 @@ import "testing"
|
|
5
5
|
func TestRNATranscription(t *testing.T) {
|
6
6
|
for _, test := range rnaTests {
|
7
7
|
if actual := ToRNA(test.input); actual != test.expected {
|
8
|
-
t.
|
9
|
-
test.input, actual, test.expected)
|
8
|
+
t.Fatalf("FAIL: %s - ToRNA(%q): %q, expected %q",
|
9
|
+
test.description, test.input, actual, test.expected)
|
10
10
|
}
|
11
|
+
t.Logf("PASS: %s", test.description)
|
11
12
|
}
|
12
13
|
}
|
13
14
|
|
@@ -29,18 +29,24 @@ type testGroup struct {
|
|
29
29
|
Cases []json.RawMessage `property:"RAW"`
|
30
30
|
EncodeCases []struct {
|
31
31
|
Description string
|
32
|
-
Input
|
33
|
-
|
32
|
+
Input struct {
|
33
|
+
String string
|
34
|
+
}
|
35
|
+
Expected string
|
34
36
|
} `property:"encode"`
|
35
37
|
DecodeCases []struct {
|
36
38
|
Description string
|
37
|
-
Input
|
38
|
-
|
39
|
+
Input struct {
|
40
|
+
String string
|
41
|
+
}
|
42
|
+
Expected string
|
39
43
|
} `property:"decode"`
|
40
44
|
EncodeDecodeCases []struct {
|
41
45
|
Description string
|
42
|
-
Input
|
43
|
-
|
46
|
+
Input struct {
|
47
|
+
String string
|
48
|
+
}
|
49
|
+
Expected string
|
44
50
|
} `property:"consistency"`
|
45
51
|
}
|
46
52
|
|
@@ -58,7 +64,7 @@ var tmpl = `package encode
|
|
58
64
|
description string
|
59
65
|
}{
|
60
66
|
{{- range .EncodeCases }}
|
61
|
-
{ {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
67
|
+
{ {{.Input.String | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
62
68
|
{{- end }}
|
63
69
|
}
|
64
70
|
{{- end }}
|
@@ -70,7 +76,7 @@ var tmpl = `package encode
|
|
70
76
|
description string
|
71
77
|
}{
|
72
78
|
{{- range .DecodeCases }}
|
73
|
-
{ {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
79
|
+
{ {{.Input.String | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
74
80
|
{{- end }}
|
75
81
|
}
|
76
82
|
{{- end }}
|
@@ -82,7 +88,7 @@ var tmpl = `package encode
|
|
82
88
|
description string
|
83
89
|
}{
|
84
90
|
{{- range .EncodeDecodeCases }}
|
85
|
-
{ {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
91
|
+
{ {{.Input.String | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
|
86
92
|
{{- end }}
|
87
93
|
}
|
88
94
|
{{- end }}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package encode
|
2
2
|
|
3
3
|
// Source: exercism/problem-specifications
|
4
|
-
// Commit:
|
5
|
-
// Problem Specifications Version: 1.
|
4
|
+
// Commit: 1b7900e run-length-encoding: apply "input" policy
|
5
|
+
// Problem Specifications Version: 1.1.0
|
6
6
|
|
7
7
|
// run-length encode a string
|
8
8
|
var encodeTests = []struct {
|