trackler 2.2.1.98 → 2.2.1.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/complex-numbers/canonical-data.json +47 -47
  4. data/problem-specifications/exercises/custom-set/canonical-data.json +13 -7
  5. data/tracks/delphi/exercises/phone-number/uPhoneNumberTests.pas +1 -1
  6. data/tracks/elixir/exercises/protein-translation/protein_translation_test.exs +5 -0
  7. data/tracks/fsharp/config.json +10 -0
  8. data/tracks/fsharp/exercises/Exercises.sln +6 -0
  9. data/tracks/fsharp/exercises/accumulate/AccumulateTest.fs +2 -0
  10. data/tracks/fsharp/exercises/bank-account/BankAccountTest.fs +2 -0
  11. data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTreeTest.fs +2 -0
  12. data/tracks/fsharp/exercises/binary/BinaryTest.fs +2 -0
  13. data/tracks/fsharp/exercises/circular-buffer/CircularBufferTest.fs +121 -117
  14. data/tracks/fsharp/exercises/complex-numbers/ComplexNumbers.fs +21 -0
  15. data/tracks/fsharp/exercises/complex-numbers/ComplexNumbers.fsproj +23 -0
  16. data/tracks/fsharp/exercises/complex-numbers/ComplexNumbersTest.fs +168 -0
  17. data/tracks/fsharp/exercises/complex-numbers/Example.fs +27 -0
  18. data/tracks/fsharp/exercises/complex-numbers/Program.fs +1 -0
  19. data/tracks/fsharp/exercises/complex-numbers/README.md +35 -0
  20. data/tracks/fsharp/exercises/diamond/DiamondTest.fs +2 -0
  21. data/tracks/fsharp/exercises/diffie-hellman/DiffieHellmanTest.fs +2 -0
  22. data/tracks/fsharp/exercises/dot-dsl/DotDslTest.fs +2 -0
  23. data/tracks/fsharp/exercises/error-handling/ErrorHandlingTest.fs +2 -0
  24. data/tracks/fsharp/exercises/go-counting/GoCountingTest.fs +2 -0
  25. data/tracks/fsharp/exercises/grade-school/GradeSchoolTest.fs +2 -0
  26. data/tracks/fsharp/exercises/hangman/HangmanTest.fs +2 -0
  27. data/tracks/fsharp/exercises/hexadecimal/HexadecimalTest.fs +2 -0
  28. data/tracks/fsharp/exercises/ledger/LedgerTest.fs +2 -0
  29. data/tracks/fsharp/exercises/lens-person/LensPersonTest.fs +2 -0
  30. data/tracks/fsharp/exercises/linked-list/LinkedListTest.fs +2 -0
  31. data/tracks/fsharp/exercises/matrix/MatrixTest.fs +2 -0
  32. data/tracks/fsharp/exercises/octal/OctalTest.fs +2 -0
  33. data/tracks/fsharp/exercises/parallel-letter-frequency/ParallelLetterFrequencyTest.fs +2 -0
  34. data/tracks/fsharp/exercises/pov/PovTest.fs +2 -0
  35. data/tracks/fsharp/exercises/protein-translation/ProteinTranslationTest.fs +2 -0
  36. data/tracks/fsharp/exercises/pythagorean-triplet/PythagoreanTripletTest.fs +2 -0
  37. data/tracks/fsharp/exercises/robot-name/RobotNameTest.fs +2 -0
  38. data/tracks/fsharp/exercises/saddle-points/SaddlePointsTest.fs +2 -0
  39. data/tracks/fsharp/exercises/say/SayTest.fs +2 -0
  40. data/tracks/fsharp/exercises/scale-generator/ScaleGeneratorTest.fs +2 -0
  41. data/tracks/fsharp/exercises/secret-handshake/SecretHandshakeTest.fs +2 -0
  42. data/tracks/fsharp/exercises/series/SeriesTest.fs +2 -0
  43. data/tracks/fsharp/exercises/sgf-parsing/SgfParsingTest.fs +2 -0
  44. data/tracks/fsharp/exercises/sieve/SieveTest.fs +2 -0
  45. data/tracks/fsharp/exercises/simple-cipher/SimpleCipherTest.fs +2 -0
  46. data/tracks/fsharp/exercises/simple-linked-list/SimpleLinkedListTest.fs +2 -0
  47. data/tracks/fsharp/exercises/space-age/SpaceAgeTest.fs +2 -0
  48. data/tracks/fsharp/exercises/strain/StrainTest.fs +2 -0
  49. data/tracks/fsharp/exercises/sublist/SublistTest.fs +2 -0
  50. data/tracks/fsharp/exercises/sum-of-multiples/SumOfMultiplesTest.fs +2 -0
  51. data/tracks/fsharp/exercises/tournament/TournamentTest.fs +2 -0
  52. data/tracks/fsharp/exercises/transpose/TransposeTest.fs +2 -0
  53. data/tracks/fsharp/exercises/transpose/TrinaryTest.fs +3 -1
  54. data/tracks/fsharp/exercises/tree-building/TreeBuildingTest.fs +2 -0
  55. data/tracks/fsharp/exercises/triangle/TriangleTest.fs +2 -0
  56. data/tracks/fsharp/exercises/trinary/TrinaryTest.fs +2 -0
  57. data/tracks/fsharp/exercises/two-bucket/TwoBucketTest.fs +2 -0
  58. data/tracks/fsharp/exercises/variable-length-quantity/VariableLengthQuantityTest.fs +2 -0
  59. data/tracks/fsharp/exercises/word-count/WordCountTest.fs +2 -0
  60. data/tracks/fsharp/exercises/word-search/WordSearchTest.fs +2 -0
  61. data/tracks/fsharp/exercises/wordy/WordyTest.fs +2 -0
  62. data/tracks/fsharp/exercises/zebra-puzzle/ZebraPuzzleTest.fs +2 -0
  63. data/tracks/fsharp/exercises/zipper/ZipperTest.fs +2 -0
  64. data/tracks/fsharp/generators/CanonicalData.fs +1 -1
  65. data/tracks/fsharp/generators/Generators.fs +89 -0
  66. data/tracks/go/config.json +16 -0
  67. data/tracks/go/exercises/rail-fence-cipher/.meta/gen.go +82 -0
  68. data/tracks/go/exercises/rail-fence-cipher/README.md +83 -0
  69. data/tracks/go/exercises/rail-fence-cipher/cases_test.go +50 -0
  70. data/tracks/go/exercises/rail-fence-cipher/example.go +58 -0
  71. data/tracks/go/exercises/rail-fence-cipher/rail_fence_cipher_test.go +15 -0
  72. data/tracks/go/exercises/say/.meta/gen.go +5 -3
  73. data/tracks/go/exercises/say/cases_test.go +2 -2
  74. data/tracks/go/exercises/scrabble-score/.meta/gen.go +5 -3
  75. data/tracks/go/exercises/scrabble-score/cases_test.go +2 -2
  76. data/tracks/go/exercises/secret-handshake/.meta/gen.go +5 -3
  77. data/tracks/go/exercises/secret-handshake/cases_test.go +2 -2
  78. data/tracks/go/exercises/transpose/.meta/gen.go +5 -3
  79. data/tracks/go/exercises/transpose/cases_test.go +30 -76
  80. data/tracks/go/exercises/word-count/.meta/gen.go +5 -3
  81. data/tracks/go/exercises/word-count/cases_test.go +2 -2
  82. data/tracks/go/exercises/wordy/.meta/gen.go +5 -3
  83. data/tracks/go/exercises/wordy/cases_test.go +2 -2
  84. data/tracks/java/exercises/largest-series-product/.meta/src/reference/java/LargestSeriesProductCalculator.java +1 -3
  85. data/tracks/java/exercises/largest-series-product/.meta/version +1 -0
  86. data/tracks/java/exercises/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java +9 -44
  87. data/tracks/ocaml/exercises/grade-school/.meta/description.md +21 -0
  88. data/tracks/ocaml/exercises/palindrome-products/.meta/description.md +35 -0
  89. data/tracks/ocaml/exercises/palindrome-products/README.md +13 -9
  90. metadata +16 -2
@@ -0,0 +1,50 @@
1
+ package railfence
2
+
3
+ // Source: exercism/problem-specifications
4
+ // Commit: c01f9ca rail-fence-cipher 1.0.1: Remove "test to" from all descriptions
5
+ // Problem Specifications Version: 1.0.1
6
+
7
+ type testCase struct {
8
+ description string
9
+ message string
10
+ rails int
11
+ expected string
12
+ }
13
+
14
+ // encode
15
+ var encodeTests = []testCase{
16
+
17
+ {"encode with two rails",
18
+ "XOXOXOXOXOXOXOXOXO",
19
+ 2,
20
+ "XXXXXXXXXOOOOOOOOO"},
21
+
22
+ {"encode with three rails",
23
+ "WEAREDISCOVEREDFLEEATONCE",
24
+ 3,
25
+ "WECRLTEERDSOEEFEAOCAIVDEN"},
26
+
27
+ {"encode with ending in the middle",
28
+ "EXERCISES",
29
+ 4,
30
+ "ESXIEECSR"},
31
+ }
32
+
33
+ // decode
34
+ var decodeTests = []testCase{
35
+
36
+ {"decode with three rails",
37
+ "TEITELHDVLSNHDTISEIIEA",
38
+ 3,
39
+ "THEDEVILISINTHEDETAILS"},
40
+
41
+ {"decode with five rails",
42
+ "EIEXMSMESAORIWSCE",
43
+ 5,
44
+ "EXERCISMISAWESOME"},
45
+
46
+ {"decode with six rails",
47
+ "133714114238148966225439541018335470986172518171757571896261",
48
+ 6,
49
+ "112358132134558914423337761098715972584418167651094617711286"},
50
+ }
@@ -0,0 +1,58 @@
1
+ package railfence
2
+
3
+ import (
4
+ "sort"
5
+ )
6
+
7
+ type pair struct {
8
+ index, value int
9
+ letter byte
10
+ }
11
+
12
+ func pattern(rails, size int) []pair {
13
+ var pairs []pair
14
+ var v, direction = 0, 1
15
+ for i := 0; i < size; i++ {
16
+ pairs = append(pairs, pair{index: i, value: v})
17
+ v += direction
18
+ if v == 0 {
19
+ direction = 1
20
+ } else if v == rails-1 {
21
+ direction = -1
22
+ }
23
+ }
24
+ return pairs
25
+ }
26
+
27
+ func sortedPattern(rails, size int) []pair {
28
+ fence := pattern(rails, size)
29
+ sort.Slice(fence, func(i, j int) bool {
30
+ f1, f2 := fence[i], fence[j]
31
+ return f1.value < f2.value || (f1.value == f2.value && f1.index < f2.index)
32
+ })
33
+ return fence
34
+ }
35
+
36
+ // Encode encodes given message with given rails
37
+ func Encode(msg string, rails int) string {
38
+ fence := sortedPattern(rails, len(msg))
39
+ var encoded []byte
40
+ for _, p := range fence {
41
+ encoded = append(encoded, msg[p.index])
42
+ }
43
+ return string(encoded)
44
+ }
45
+
46
+ // Decode decodes given message with given rails
47
+ func Decode(msg string, rails int) string {
48
+ fence := sortedPattern(rails, len(msg))
49
+ for i := range msg {
50
+ fence[i].letter = msg[i]
51
+ }
52
+ sort.Slice(fence, func(i, j int) bool { return fence[i].index < fence[j].index })
53
+ var decoded []byte
54
+ for _, p := range fence {
55
+ decoded = append(decoded, p.letter)
56
+ }
57
+ return string(decoded)
58
+ }
@@ -0,0 +1,15 @@
1
+ package railfence
2
+
3
+ import "testing"
4
+
5
+ func testCases(op func(string, int) string, cases []testCase, t *testing.T) {
6
+ for _, tc := range cases {
7
+ if actual := op(tc.message, tc.rails); actual != tc.expected {
8
+ t.Fatalf("FAIL: %s\nExpected: %q\nActual: %q", tc.description, tc.expected, actual)
9
+ }
10
+ t.Logf("PASS: %s", tc.description)
11
+ }
12
+ }
13
+
14
+ func TestEncode(t *testing.T) { testCases(Encode, encodeTests, t) }
15
+ func TestDecode(t *testing.T) { testCases(Decode, decodeTests, t) }
@@ -31,8 +31,10 @@ type js struct {
31
31
  type OneCase struct {
32
32
  Description string
33
33
  Property string
34
- Input int64
35
- Expected interface{}
34
+ Input struct {
35
+ Number int64
36
+ }
37
+ Expected interface{}
36
38
  }
37
39
 
38
40
  func (c OneCase) ErrorExpected() bool {
@@ -61,7 +63,7 @@ var testCases = []struct {
61
63
  }{ {{range .J.Cases}}
62
64
  {
63
65
  description: {{printf "%q" .Description}},
64
- input: {{printf "%v" .Input}},
66
+ input: {{printf "%v" .Input.Number}},
65
67
  {{if .ErrorExpected}}expectError: true,
66
68
  {{else}}expected: {{printf "%q" .Expected}},
67
69
  {{- end}}
@@ -1,8 +1,8 @@
1
1
  package say
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: be403e1 say: Fix canonical-data.json formatting
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: c1467a0 say: Apply new "input" policy
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  var testCases = []struct {
8
8
  description string
@@ -22,8 +22,10 @@ func main() {
22
22
  type js struct {
23
23
  Cases []struct {
24
24
  Description string
25
- Input string
26
- Expected int
25
+ Input struct {
26
+ Word string
27
+ }
28
+ Expected int
27
29
  }
28
30
  }
29
31
 
@@ -38,6 +40,6 @@ type scrabbleTest struct {
38
40
  }
39
41
 
40
42
  var scrabbleScoreTests = []scrabbleTest {
41
- {{range .J.Cases}}{ "{{.Input}}", {{.Expected}}}, // {{.Description}}
43
+ {{range .J.Cases}}{ "{{.Input.Word}}", {{.Expected}}}, // {{.Description}}
42
44
  {{end}}}
43
45
  `
@@ -1,8 +1,8 @@
1
1
  package scrabble
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 11ed503 scrabble-score: Make canonical-data.json compliant
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: 0d882ed scrabble-score: Apply new "input" policy
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  type scrabbleTest struct {
8
8
  input string
@@ -25,8 +25,10 @@ type js struct {
25
25
  Cases []struct {
26
26
  Description string
27
27
  Property string
28
- Input uint
29
- Expected []string
28
+ Input struct {
29
+ Number uint
30
+ }
31
+ Expected []string
30
32
  }
31
33
  }
32
34
  }
@@ -42,7 +44,7 @@ type secretHandshakeTest struct {
42
44
  }
43
45
 
44
46
  var tests = []secretHandshakeTest {
45
- {{range .J.Cases}} {{range .Cases}}{ {{ .Input }}, {{printf "%#v" .Expected }},
47
+ {{range .J.Cases}} {{range .Cases}}{ {{ .Input.Number }}, {{printf "%#v" .Expected }},
46
48
  },
47
49
  {{end}}{{end}}
48
50
  }
@@ -1,8 +1,8 @@
1
1
  package secret
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 8acd78c Replace x-common with problem-specifications
5
- // Problem Specifications Version: 1.1.0
4
+ // Commit: a9e4df8 secret-handshake: Apply new "input" policy
5
+ // Problem Specifications Version: 1.2.0
6
6
 
7
7
  type secretHandshakeTest struct {
8
8
  code uint
@@ -22,8 +22,10 @@ func main() {
22
22
  type js struct {
23
23
  Cases []struct {
24
24
  Description string
25
- Input []string
26
- Expected []string
25
+ Input struct {
26
+ Lines []string
27
+ }
28
+ Expected []string
27
29
  }
28
30
  }
29
31
 
@@ -40,7 +42,7 @@ var testCases = []struct {
40
42
  {{range .J.Cases}}{
41
43
  {{printf "%q" .Description}},
42
44
  []string{
43
- {{range .Input}} {{printf "%q" .}},
45
+ {{range .Input.Lines}} {{printf "%q" .}},
44
46
  {{end}}},
45
47
  []string{
46
48
  {{range .Expected}} {{printf "%q" .}},
@@ -1,8 +1,8 @@
1
1
  package transpose
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 6dba022 transpose: Fix canonical-data.json formatting
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: 92bc877 switch to new json-schema
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  var testCases = []struct {
8
8
  description string
@@ -116,6 +116,34 @@ var testCases = []struct {
116
116
  " .",
117
117
  },
118
118
  },
119
+ {
120
+ "mixed line length",
121
+ []string{
122
+ "The longest line.",
123
+ "A long line.",
124
+ "A longer line.",
125
+ "A line.",
126
+ },
127
+ []string{
128
+ "TAAA",
129
+ "h ",
130
+ "elll",
131
+ " ooi",
132
+ "lnnn",
133
+ "ogge",
134
+ "n e.",
135
+ "glr",
136
+ "ei ",
137
+ "snl",
138
+ "tei",
139
+ " .n",
140
+ "l e",
141
+ "i .",
142
+ "n",
143
+ "e",
144
+ ".",
145
+ },
146
+ },
119
147
  {
120
148
  "square",
121
149
  []string{
@@ -171,78 +199,4 @@ var testCases = []struct {
171
199
  " R",
172
200
  },
173
201
  },
174
- {
175
- "many lines",
176
- []string{
177
- "Chor. Two households, both alike in dignity,",
178
- "In fair Verona, where we lay our scene,",
179
- "From ancient grudge break to new mutiny,",
180
- "Where civil blood makes civil hands unclean.",
181
- "From forth the fatal loins of these two foes",
182
- "A pair of star-cross'd lovers take their life;",
183
- "Whose misadventur'd piteous overthrows",
184
- "Doth with their death bury their parents' strife.",
185
- "The fearful passage of their death-mark'd love,",
186
- "And the continuance of their parents' rage,",
187
- "Which, but their children's end, naught could remove,",
188
- "Is now the two hours' traffic of our stage;",
189
- "The which if you with patient ears attend,",
190
- "What here shall miss, our toil shall strive to mend.",
191
- },
192
- []string{
193
- "CIFWFAWDTAWITW",
194
- "hnrhr hohnhshh",
195
- "o oeopotedi ea",
196
- "rfmrmash cn t",
197
- ".a e ie fthow ",
198
- " ia fr weh,whh",
199
- "Trnco miae ie",
200
- "w ciroitr btcr",
201
- "oVivtfshfcuhhe",
202
- " eeih a uote ",
203
- "hrnl sdtln is",
204
- "oot ttvh tttfh",
205
- "un bhaeepihw a",
206
- "saglernianeoyl",
207
- "e,ro -trsui ol",
208
- "h uofcu sarhu ",
209
- "owddarrdan o m",
210
- "lhg to'egccuwi",
211
- "deemasdaeehris",
212
- "sr als t ists",
213
- ",ebk 'phool'h,",
214
- " reldi ffd ",
215
- "bweso tb rtpo",
216
- "oea ileutterau",
217
- "t kcnoorhhnatr",
218
- "hl isvuyee'fi ",
219
- " atv es iisfet",
220
- "ayoior trr ino",
221
- "l lfsoh ecti",
222
- "ion vedpn l",
223
- "kuehtteieadoe ",
224
- "erwaharrar,fas",
225
- " nekt te rh",
226
- "ismdsehphnnosa",
227
- "ncuse ra-tau l",
228
- " et tormsural",
229
- "dniuthwea'g t ",
230
- "iennwesnr hsts",
231
- "g,ycoi tkrttet",
232
- "n ,l r s'a anr",
233
- "i ef 'dgcgdi",
234
- "t aol eoe,v",
235
- "y nei sl,u; e",
236
- ", .sf to l ",
237
- " e rv d t",
238
- " ; ie o",
239
- " f, r ",
240
- " e e m",
241
- " . m e",
242
- " o n",
243
- " v d",
244
- " e .",
245
- " ,",
246
- },
247
- },
248
202
  }
@@ -22,8 +22,10 @@ func main() {
22
22
  type js struct {
23
23
  Cases []struct {
24
24
  Description string
25
- Input string
26
- Expected map[string]int
25
+ Input struct {
26
+ Sentence string
27
+ }
28
+ Expected map[string]int
27
29
  }
28
30
  }
29
31
 
@@ -39,7 +41,7 @@ var testCases = []struct {
39
41
  }{
40
42
  {{range .J.Cases}}{
41
43
  {{printf "%q" .Description}},
42
- {{printf "%q" .Input}},
44
+ {{printf "%q" .Input.Sentence}},
43
45
  Frequency{ {{range $key, $val := .Expected}} {{printf "%q: %d, " $key $val}} {{end}} },
44
46
  },
45
47
  {{end}}}
@@ -1,8 +1,8 @@
1
1
  package wordcount
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 8793a05 word-count: Add test for multiple whitespace (#1023)
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: 5559f34 word-count: Apply new "input" policy
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  var testCases = []struct {
8
8
  description string
@@ -20,8 +20,10 @@ func main() {
20
20
 
21
21
  type OneCase struct {
22
22
  Description string
23
- Input string
24
- Expected interface{}
23
+ Input struct {
24
+ Question string
25
+ }
26
+ Expected interface{}
25
27
  }
26
28
 
27
29
  // The JSON structure we expect to be able to unmarshal into
@@ -65,7 +67,7 @@ type wordyTest struct {
65
67
  var tests = []wordyTest {
66
68
  {{range .J.Cases}}{
67
69
  "{{.Description}}",
68
- "{{.Input}}",
70
+ "{{.Input.Question}}",
69
71
  {{if .Valid}} true,
70
72
  {{.Answer}},
71
73
  {{- else}} false,
@@ -1,8 +1,8 @@
1
1
  package wordy
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 5b8ad58 wordy: Fix canonical-data.json formatting
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: df75482 wordy: Apply new "input" policy
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  type wordyTest struct {
8
8
  description string