trackler 2.2.1.100 → 2.2.1.101

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +37 -19
  4. data/problem-specifications/exercises/ocr-numbers/canonical-data.json +144 -110
  5. data/problem-specifications/exercises/palindrome-products/canonical-data.json +49 -25
  6. data/problem-specifications/exercises/poker/canonical-data.json +171 -115
  7. data/problem-specifications/exercises/prime-factors/canonical-data.json +22 -8
  8. data/problem-specifications/exercises/protein-translation/canonical-data.json +70 -24
  9. data/problem-specifications/exercises/proverb/canonical-data.json +24 -12
  10. data/problem-specifications/exercises/queen-attack/canonical-data.json +115 -91
  11. data/problem-specifications/exercises/rail-fence-cipher/canonical-data.json +25 -13
  12. data/problem-specifications/exercises/raindrops/canonical-data.json +55 -19
  13. data/problem-specifications/exercises/rational-numbers/canonical-data.json +374 -0
  14. data/problem-specifications/exercises/rational-numbers/description.md +27 -0
  15. data/problem-specifications/exercises/rational-numbers/metadata.yml +4 -0
  16. data/problem-specifications/exercises/rectangles/canonical-data.json +93 -67
  17. data/problem-specifications/exercises/reverse-string/canonical-data.json +16 -6
  18. data/problem-specifications/exercises/rna-transcription/metadata.yml +3 -3
  19. data/problem-specifications/exercises/roman-numerals/canonical-data.json +10 -2
  20. data/tracks/bash/config.json +11 -11
  21. data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +7 -0
  22. data/tracks/clojure/exercises/armstrong-numbers/README.md +1 -1
  23. data/tracks/delphi/config.json +11 -0
  24. data/tracks/delphi/exercises/clock/uClockExample.pas +6 -1
  25. data/tracks/delphi/exercises/clock/uClockTest.pas +22 -19
  26. data/tracks/delphi/exercises/isbn-verifier/README.md +1 -1
  27. data/tracks/delphi/exercises/reverse-string/README.md +1 -1
  28. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  29. data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +14 -0
  30. data/tracks/delphi/exercises/space-age/README.md +45 -0
  31. data/tracks/delphi/exercises/space-age/SpaceAge.dpr +60 -0
  32. data/tracks/delphi/exercises/space-age/uSpaceAgeExample.pas +120 -0
  33. data/tracks/delphi/exercises/space-age/uSpaceAgeTests.pas +135 -0
  34. data/tracks/delphi/exercises/two-fer/README.md +1 -1
  35. data/tracks/elixir/exercises/nth-prime/nth_prime.exs +0 -1
  36. data/tracks/fsharp/exercises/pov/PovTest.fs +66 -53
  37. data/tracks/fsharp/exercises/space-age/Example.fs +11 -11
  38. data/tracks/fsharp/exercises/space-age/SpaceAge.fs +1 -1
  39. data/tracks/fsharp/exercises/space-age/SpaceAgeTest.fs +21 -34
  40. data/tracks/fsharp/exercises/triangle/Example.fs +11 -16
  41. data/tracks/fsharp/exercises/triangle/Triangle.fs +4 -5
  42. data/tracks/fsharp/exercises/triangle/TriangleTest.fs +44 -31
  43. data/tracks/fsharp/generators/Generators.fs +121 -0
  44. data/tracks/go/config.json +12 -0
  45. data/tracks/go/exercises/clock/.meta/gen.go +37 -13
  46. data/tracks/go/exercises/clock/cases_test.go +10 -10
  47. data/tracks/go/exercises/clock/clock_test.go +16 -2
  48. data/tracks/go/exercises/clock/example.go +4 -0
  49. data/tracks/go/exercises/clock/example_clock_test.go +3 -3
  50. data/tracks/go/exercises/parallel-letter-frequency/.meta/hints.md +33 -0
  51. data/tracks/go/exercises/parallel-letter-frequency/README.md +35 -0
  52. data/tracks/go/exercises/raindrops/.meta/hints.md +7 -4
  53. data/tracks/go/exercises/raindrops/README.md +12 -0
  54. data/tracks/go/exercises/roman-numerals/.meta/gen.go +4 -2
  55. data/tracks/go/exercises/roman-numerals/cases_test.go +3 -2
  56. data/tracks/go/exercises/space-age/.meta/hints.md +10 -0
  57. data/tracks/go/exercises/space-age/README.md +14 -1
  58. data/tracks/go/exercises/twelve-days/README.md +2 -5
  59. data/tracks/go/exercises/two-bucket/.meta/gen.go +62 -0
  60. data/tracks/go/exercises/two-bucket/.meta/hints.md +16 -0
  61. data/tracks/go/exercises/two-bucket/README.md +72 -0
  62. data/tracks/go/exercises/two-bucket/cases_test.go +44 -0
  63. data/tracks/go/exercises/two-bucket/example.go +198 -0
  64. data/tracks/go/exercises/two-bucket/two_bucket_test.go +61 -0
  65. data/tracks/idris/.travis.yml +3 -2
  66. data/tracks/idris/bin/fetch-idris-testing.sh +11 -0
  67. data/tracks/idris/bin/solve_exercises.sh +2 -2
  68. data/tracks/idris/config.json +11 -0
  69. data/tracks/idris/config/exercise_readme.go.tmpl +0 -3
  70. data/tracks/idris/docs/INSTALLATION.md +22 -0
  71. data/tracks/idris/docs/TESTS.md +12 -4
  72. data/tracks/idris/exercises/accumulate/src/Accumulate.idr +5 -0
  73. data/tracks/idris/exercises/hamming/Hamming.ipkg +2 -0
  74. data/tracks/idris/exercises/hamming/src/{example.idr → Example.idr} +5 -1
  75. data/tracks/idris/exercises/hamming/src/Hamming.idr +13 -5
  76. data/tracks/idris/exercises/hamming/src/Test/Hamming.idr +31 -58
  77. data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +2 -0
  78. data/tracks/idris/exercises/hello-world/src/Example.idr +9 -0
  79. data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +6 -1
  80. data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +18 -18
  81. data/tracks/idris/exercises/leap/Leap.ipkg +2 -0
  82. data/tracks/idris/exercises/leap/src/{example.idr → Example.idr} +4 -0
  83. data/tracks/idris/exercises/leap/src/Leap.idr +5 -1
  84. data/tracks/idris/exercises/leap/src/Test/Leap.idr +21 -30
  85. data/tracks/idris/exercises/rna-transcription/Makefile +23 -0
  86. data/tracks/idris/exercises/rna-transcription/README.md +27 -0
  87. data/tracks/idris/exercises/rna-transcription/RnaTranscription.ipkg +5 -0
  88. data/tracks/idris/exercises/rna-transcription/src/RnaTranscription.idr +17 -0
  89. data/tracks/idris/exercises/rna-transcription/src/Test/RnaTranscription.idr +27 -0
  90. data/tracks/idris/exercises/rna-transcription/src/example.idr +35 -0
  91. data/tracks/java/exercises/etl/.meta/version +1 -0
  92. data/tracks/java/exercises/gigasecond/.meta/version +1 -0
  93. data/tracks/java/exercises/isbn-verifier/README.md +1 -1
  94. data/tracks/java/exercises/nucleotide-count/.meta/src/reference/java/NucleotideCounter.java +7 -1
  95. data/tracks/java/exercises/nucleotide-count/.meta/version +1 -0
  96. data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideCounterTest.java +19 -54
  97. data/tracks/java/exercises/proverb/.meta/version +1 -0
  98. data/tracks/java/exercises/reverse-string/README.md +1 -1
  99. data/tracks/java/exercises/rna-transcription/README.md +1 -1
  100. data/tracks/java/exercises/sum-of-multiples/.meta/version +1 -0
  101. data/tracks/java/exercises/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +13 -1
  102. data/tracks/kotlin/config/exercise_readme.go.tmpl +0 -3
  103. data/tracks/kotlin/docs/TESTS.md +1 -1
  104. data/tracks/objective-c/config.json +11 -0
  105. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.h +7 -0
  106. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.m +26 -0
  107. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m +39 -0
  108. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +31 -1
  109. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/OCLint.xcscheme +3 -1
  110. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/xobjectivecTest.xcscheme +3 -1
  111. data/tracks/ocaml/exercises/forth/example.ml +9 -9
  112. data/tracks/ocaml/tools/test-generator/Makefile +3 -9
  113. data/tracks/ocaml/tools/test-generator/src/test_gen.ml +18 -16
  114. data/tracks/perl6/exercises/acronym/.meta/exercise-data.yaml +1 -1
  115. data/tracks/perl6/exercises/acronym/acronym.t +4 -14
  116. data/tracks/perl6/exercises/all-your-base/all-your-base.t +0 -2
  117. data/tracks/perl6/exercises/allergies/allergies.t +0 -2
  118. data/tracks/perl6/exercises/anagram/.meta/exercise-data.yaml +1 -1
  119. data/tracks/perl6/exercises/anagram/anagram.t +2 -40
  120. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +0 -1
  121. data/tracks/perl6/exercises/bob/bob.t +0 -2
  122. data/tracks/perl6/exercises/clock/.meta/exercise-data.yaml +15 -11
  123. data/tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 +5 -1
  124. data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
  125. data/tracks/perl6/exercises/clock/clock.t +314 -217
  126. data/tracks/perl6/exercises/etl/etl.t +0 -2
  127. data/tracks/perl6/exercises/flatten-array/flatten-array.t +0 -2
  128. data/tracks/perl6/exercises/grains/grains.t +0 -2
  129. data/tracks/perl6/exercises/hamming/.meta/exercise-data.yaml +2 -2
  130. data/tracks/perl6/exercises/hamming/hamming.t +63 -35
  131. data/tracks/perl6/exercises/hello-world/hello-world.t +2 -3
  132. data/tracks/perl6/exercises/leap/.meta/exercise-data.yaml +1 -1
  133. data/tracks/perl6/exercises/leap/leap.t +14 -8
  134. data/tracks/perl6/exercises/luhn/luhn.t +0 -2
  135. data/tracks/perl6/exercises/nucleotide-count/.meta/exercise-data.yaml +2 -2
  136. data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +18 -10
  137. data/tracks/perl6/exercises/pangram/.meta/exercise-data.yaml +1 -1
  138. data/tracks/perl6/exercises/pangram/pangram.t +32 -14
  139. data/tracks/perl6/exercises/phone-number/.meta/exercise-data.yaml +4 -4
  140. data/tracks/perl6/exercises/phone-number/.meta/solutions/Phone.pm6 +1 -1
  141. data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
  142. data/tracks/perl6/exercises/phone-number/phone-number.t +59 -21
  143. data/tracks/perl6/exercises/raindrops/raindrops.t +0 -2
  144. data/tracks/perl6/exercises/rna-transcription/.meta/exercise-data.yaml +1 -1
  145. data/tracks/perl6/exercises/rna-transcription/README.md +1 -1
  146. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -9
  147. data/tracks/perl6/exercises/roman-numerals/.meta/exercise-data.yaml +3 -3
  148. data/tracks/perl6/exercises/roman-numerals/.meta/solutions/RomanNumerals.pm6 +1 -1
  149. data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
  150. data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +66 -24
  151. data/tracks/perl6/exercises/scrabble-score/.meta/exercise-data.yaml +1 -1
  152. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +35 -15
  153. data/tracks/perl6/exercises/space-age/.meta/exercise-data.yaml +1 -1
  154. data/tracks/perl6/exercises/space-age/space-age.t +34 -20
  155. data/tracks/perl6/exercises/two-fer/.meta/exercise-data.yaml +2 -2
  156. data/tracks/perl6/exercises/two-fer/two-fer.t +15 -11
  157. data/tracks/perl6/exercises/word-count/.meta/exercise-data.yaml +1 -1
  158. data/tracks/perl6/exercises/word-count/word-count.t +46 -26
  159. data/tracks/perl6/exercises/wordy/.meta/exercise-data.yaml +2 -2
  160. data/tracks/perl6/exercises/wordy/wordy.t +51 -21
  161. data/tracks/perl6/lib/Exercism/Generator.pm6 +1 -1
  162. data/tracks/perl6/t/generated-tests.t +1 -1
  163. data/tracks/perl6/templates/test.mustache +0 -1
  164. data/tracks/python/config.json +12 -0
  165. data/tracks/python/exercises/forth/example.py +1 -1
  166. data/tracks/python/exercises/forth/forth_test.py +43 -38
  167. data/tracks/python/exercises/spiral-matrix/README.md +42 -0
  168. data/tracks/python/exercises/spiral-matrix/example.py +11 -0
  169. data/tracks/python/exercises/spiral-matrix/spiral_matrix.py +2 -0
  170. data/tracks/python/exercises/spiral-matrix/spiral_matrix_test.py +40 -0
  171. data/tracks/racket/config/exercise_readme.go.tmpl +24 -4
  172. data/tracks/racket/exercises/accumulate/README.md +3 -6
  173. data/tracks/racket/exercises/acronym/README.md +3 -4
  174. data/tracks/racket/exercises/allergies/README.md +3 -4
  175. data/tracks/racket/exercises/anagram/README.md +3 -3
  176. data/tracks/racket/exercises/bob/README.md +5 -3
  177. data/tracks/racket/exercises/collatz-conjecture/README.md +3 -3
  178. data/tracks/racket/exercises/difference-of-squares/README.md +3 -3
  179. data/tracks/racket/exercises/etl/README.md +6 -4
  180. data/tracks/racket/exercises/gigasecond/README.md +3 -3
  181. data/tracks/racket/exercises/grains/README.md +3 -4
  182. data/tracks/racket/exercises/grep/README.md +15 -15
  183. data/tracks/racket/exercises/hamming/README.md +3 -3
  184. data/tracks/racket/exercises/hello-world/README.md +1 -1
  185. data/tracks/racket/exercises/leap/README.md +4 -4
  186. data/tracks/racket/exercises/list-ops/README.md +3 -4
  187. data/tracks/racket/exercises/meetup/README.md +19 -15
  188. data/tracks/racket/exercises/nucleotide-count/README.md +11 -25
  189. data/tracks/racket/exercises/perfect-numbers/README.md +5 -5
  190. data/tracks/racket/exercises/phone-number/README.md +7 -6
  191. data/tracks/racket/exercises/raindrops/README.md +3 -3
  192. data/tracks/racket/exercises/rna-transcription/README.md +4 -4
  193. data/tracks/racket/exercises/roman-numerals/README.md +4 -4
  194. data/tracks/racket/exercises/say/README.md +3 -3
  195. data/tracks/racket/exercises/scrabble-score/README.md +6 -4
  196. data/tracks/racket/exercises/word-count/README.md +4 -5
  197. data/tracks/scheme/config/exercise_readme.go.tmpl +0 -3
  198. data/tracks/scheme/docs/INSTALLATION.md +23 -14
  199. metadata +40 -9
  200. data/tracks/idris/docs/EXERCISE_README_INSERT.md +0 -0
  201. data/tracks/idris/exercises/hello-world/src/example.idr +0 -5
  202. data/tracks/kotlin/config/exercise-readme-insert.md +0 -1
  203. data/tracks/racket/docs/EXERCISE_README_INSERT.md +0 -23
  204. data/tracks/scheme/docs/EXERCISE_README_INSERT.md +0 -0
@@ -1223,6 +1223,18 @@
1223
1223
  "unlocked_by": "flatten-array",
1224
1224
  "uuid": "6b313720-104a-46c2-8290-4b4af121101f "
1225
1225
  },
1226
+ {
1227
+ "core": false,
1228
+ "difficulty": 5,
1229
+ "slug": "two-bucket",
1230
+ "topics": [
1231
+ "algorithms",
1232
+ "conditionals",
1233
+ "searching"
1234
+ ],
1235
+ "unlocked_by": "binary-search",
1236
+ "uuid": "549bf4a0-b8eb-4f66-8990-7df6cdfaee0c"
1237
+ },
1226
1238
  {
1227
1239
  "core": false,
1228
1240
  "difficulty": 4,
@@ -29,19 +29,32 @@ type testGroup struct {
29
29
  Description string
30
30
  Cases []json.RawMessage `property:"RAW"`
31
31
  CreateCases []struct {
32
- Description string
33
- Hour, Minute int
34
- Expected string
32
+ Description string
33
+ Input struct {
34
+ Hour, Minute int
35
+ }
36
+ Expected string
35
37
  } `property:"create"`
36
38
  AddCases []struct {
37
- Description string
38
- Hour, Minute, Add int
39
- Expected string
39
+ Description string
40
+ Input struct {
41
+ Hour, Minute, Value int
42
+ }
43
+ Expected string
40
44
  } `property:"add"`
45
+ SubtractCases []struct {
46
+ Description string
47
+ Input struct {
48
+ Hour, Minute, Value int
49
+ }
50
+ Expected string
51
+ } `property:"subtract"`
41
52
  EqCases []struct {
42
- Description string
43
- Clock1, Clock2 struct{ Hour, Minute int }
44
- Expected bool
53
+ Description string
54
+ Input struct {
55
+ Clock1, Clock2 struct{ Hour, Minute int }
56
+ }
57
+ Expected bool
45
58
  } `property:"equal"`
46
59
  }
47
60
 
@@ -62,7 +75,7 @@ var tmpl = `package clock
62
75
  want string
63
76
  }{
64
77
  {{- range .CreateCases }}
65
- { {{.Hour}}, {{.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
78
+ { {{.Input.Hour}}, {{.Input.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
66
79
  {{- end }}
67
80
  }
68
81
  {{- end }}
@@ -73,7 +86,18 @@ var tmpl = `package clock
73
86
  want string
74
87
  }{
75
88
  {{- range .AddCases }}
76
- { {{.Hour}}, {{.Minute}}, {{.Add}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
89
+ { {{.Input.Hour}}, {{.Input.Minute}}, {{.Input.Value}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
90
+ {{- end }}
91
+ }
92
+ {{- end }}
93
+
94
+ {{- if .SubtractCases }}
95
+ var {{ .GroupShortName }}Tests = []struct {
96
+ h, m, a int
97
+ want string
98
+ }{
99
+ {{- range .SubtractCases }}
100
+ { {{.Input.Hour}}, {{.Input.Minute}}, {{.Input.Value}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
77
101
  {{- end }}
78
102
  }
79
103
  {{- end }}
@@ -87,8 +111,8 @@ var tmpl = `package clock
87
111
  {{- range .EqCases }}
88
112
  // {{.Description}}
89
113
  {
90
- hm{ {{.Clock1.Hour}}, {{.Clock1.Minute}}},
91
- hm{ {{.Clock2.Hour}}, {{.Clock2.Minute}}},
114
+ hm{ {{.Input.Clock1.Hour}}, {{.Input.Clock1.Minute}}},
115
+ hm{ {{.Input.Clock2.Hour}}, {{.Input.Clock2.Minute}}},
92
116
  {{.Expected}},
93
117
  },
94
118
  {{- end }}
@@ -1,8 +1,8 @@
1
1
  package clock
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 54c3b74 Cleanup canonical-data for clock
5
- // Problem Specifications Version: 1.0.1
4
+ // Commit: 8b96944 clock: remove obsolete sentence from comment
5
+ // Problem Specifications Version: 2.2.1
6
6
 
7
7
  // Create a new clock with an initial time
8
8
  var timeTests = []struct {
@@ -50,14 +50,14 @@ var subtractTests = []struct {
50
50
  h, m, a int
51
51
  want string
52
52
  }{
53
- {10, 3, -3, "10:00"}, // subtract minutes
54
- {10, 3, -30, "09:33"}, // subtract to previous hour
55
- {10, 3, -70, "08:53"}, // subtract more than an hour
56
- {0, 3, -4, "23:59"}, // subtract across midnight
57
- {0, 0, -160, "21:20"}, // subtract more than two hours
58
- {6, 15, -160, "03:35"}, // subtract more than two hours with borrow
59
- {5, 32, -1500, "04:32"}, // subtract more than one day (1500 min = 25 hrs)
60
- {2, 20, -3000, "00:20"}, // subtract more than two days
53
+ {10, 3, 3, "10:00"}, // subtract minutes
54
+ {10, 3, 30, "09:33"}, // subtract to previous hour
55
+ {10, 3, 70, "08:53"}, // subtract more than an hour
56
+ {0, 3, 4, "23:59"}, // subtract across midnight
57
+ {0, 0, 160, "21:20"}, // subtract more than two hours
58
+ {6, 15, 160, "03:35"}, // subtract more than two hours with borrow
59
+ {5, 32, 1500, "04:32"}, // subtract more than one day (1500 min = 25 hrs)
60
+ {2, 20, 3000, "00:20"}, // subtract more than two days
61
61
  }
62
62
 
63
63
  // Compare two clocks for equality
@@ -44,13 +44,17 @@ func TestAddMinutes(t *testing.T) {
44
44
  a.h, a.m, a.a, got, a.want)
45
45
  }
46
46
  }
47
+ t.Log(len(addTests), "test cases")
48
+ }
49
+
50
+ func TestSubtractMinutes(t *testing.T) {
47
51
  for _, a := range subtractTests {
48
- if got := New(a.h, a.m).Add(a.a); got.String() != a.want {
52
+ if got := New(a.h, a.m).Subtract(a.a); got.String() != a.want {
49
53
  t.Fatalf("New(%d, %d).Add(%d) = %q, want %q",
50
54
  a.h, a.m, a.a, got, a.want)
51
55
  }
52
56
  }
53
- t.Log(len(addTests), "test cases")
57
+ t.Log(len(subtractTests), "test cases")
54
58
  }
55
59
 
56
60
  func TestCompareClocks(t *testing.T) {
@@ -81,6 +85,16 @@ func BenchmarkAddMinutes(b *testing.B) {
81
85
  }
82
86
  }
83
87
 
88
+ func BenchmarkSubtractMinutes(b *testing.B) {
89
+ c := New(12, 0)
90
+ b.ResetTimer()
91
+ for i := 0; i < b.N; i++ {
92
+ for _, a := range subtractTests {
93
+ c.Subtract(a.a)
94
+ }
95
+ }
96
+ }
97
+
84
98
  func BenchmarkCreateClocks(b *testing.B) {
85
99
  for i := 0; i < b.N; i++ {
86
100
  for _, n := range timeTests {
@@ -16,6 +16,10 @@ func (c Clock) Add(m int) Clock {
16
16
  return New(0, int(c)+m)
17
17
  }
18
18
 
19
+ func (c Clock) Subtract(m int) Clock {
20
+ return New(0, int(c)-m)
21
+ }
22
+
19
23
  func (c Clock) String() string {
20
24
  return fmt.Sprintf("%02d:%02d", c/60, c%60)
21
25
  }
@@ -10,7 +10,7 @@ func ExampleClock_new() {
10
10
  // Output: 10:30
11
11
  }
12
12
 
13
- func ExampleClock_Add_add() {
13
+ func ExampleClock_Add() {
14
14
  // create a clock
15
15
  clock := New(10, 30)
16
16
 
@@ -21,12 +21,12 @@ func ExampleClock_Add_add() {
21
21
  // Output: 11:00
22
22
  }
23
23
 
24
- func ExampleClock_Add_subtract() {
24
+ func ExampleClock_Subtract() {
25
25
  // create a clock
26
26
  clock := New(10, 30)
27
27
 
28
28
  // subtract an hour and a half from it
29
- clock = clock.Add(-90)
29
+ clock = clock.Subtract(90)
30
30
  fmt.Println(clock.String())
31
31
 
32
32
  // Output: 09:00
@@ -0,0 +1,33 @@
1
+ ## Concurrency vs Parallelism
2
+
3
+ Go supports concurrency via "[goroutines](https://golangbot.com/goroutines/)"
4
+ which are started with the `go` keyword. It is a simple, lightweight and elegant
5
+ way to provide concurrency support and is one of the greatest strengths of the
6
+ language.
7
+
8
+ You may notice that while this exercise is called _Parallel_ letter frequency
9
+ you don't see the term "Parallel" used very often in Go. Gophers prefer to use
10
+ the term **Concurrent** to describe the management of multiple independent
11
+ goroutines ("processes" or "threads" in other language contexts). Although
12
+ these terms are often used interchangeably Gophers like to be technically
13
+ correct and use "concurrent" when discussing the seemingly simultaneous
14
+ executions of goroutines.
15
+
16
+ While we can plan for our programs to run in parallel, and at times they may
17
+ appear to run in parallel, without strict knowledge of the execution context of
18
+ our code all we can guarantee is that processes will run concurrently. In other
19
+ words they may be executing sequentially faster than we can distinguish but not
20
+ strictly simultaneously.
21
+
22
+ For more take a look at The Go Blog's post: [Concurrency is not parallelism](https://blog.golang.org/concurrency-is-not-parallelism).
23
+
24
+ ## Concurrency Resources
25
+
26
+ If you are new to the concurrency features in Go here are some resources to get
27
+ you started. We recommend looking over these before starting this exercise:
28
+
29
+ * [Concurrency in the Golang Book](https://www.golang-book.com/books/intro/10)
30
+ * [A Tour of Go's concurrency section](https://tour.golang.org/concurrency/1)
31
+ * [Go's sync.Map](https://medium.com/@deckarep/the-new-kid-in-town-gos-sync-map-de24a6bf7c2c)
32
+
33
+ For a really deep dive you can try the book [Concurrency in Go](http://shop.oreilly.com/product/0636920046189.do) by [@kat-co](https://github.com/kat-co).
@@ -7,6 +7,41 @@ sequentially. A common example is counting the frequency of letters.
7
7
  Create a function that returns the total frequency of each letter in a
8
8
  list of texts and that employs parallelism.
9
9
 
10
+ ## Concurrency vs Parallelism
11
+
12
+ Go supports concurrency via "[goroutines](https://golangbot.com/goroutines/)"
13
+ which are started with the `go` keyword. It is a simple, lightweight and elegant
14
+ way to provide concurrency support and is one of the greatest strengths of the
15
+ language.
16
+
17
+ You may notice that while this exercise is called _Parallel_ letter frequency
18
+ you don't see the term "Parallel" used very often in Go. Gophers prefer to use
19
+ the term **Concurrent** to describe the management of multiple independent
20
+ goroutines ("processes" or "threads" in other language contexts). Although
21
+ these terms are often used interchangeably Gophers like to be technically
22
+ correct and use "concurrent" when discussing the seemingly simultaneous
23
+ executions of goroutines.
24
+
25
+ While we can plan for our programs to run in parallel, and at times they may
26
+ appear to run in parallel, without strict knowledge of the execution context of
27
+ our code all we can guarantee is that processes will run concurrently. In other
28
+ words they may be executing sequentially faster than we can distinguish but not
29
+ strictly simultaneously.
30
+
31
+ For more take a look at The Go Blog's post: [Concurrency is not parallelism](https://blog.golang.org/concurrency-is-not-parallelism).
32
+
33
+ ## Concurrency Resources
34
+
35
+ If you are new to the concurrency features in Go here are some resources to get
36
+ you started. We recommend looking over these before starting this exercise:
37
+
38
+ * [Concurrency in the Golang Book](https://www.golang-book.com/books/intro/10)
39
+ * [A Tour of Go's concurrency section](https://tour.golang.org/concurrency/1)
40
+ * [Go's sync.Map](https://medium.com/@deckarep/the-new-kid-in-town-gos-sync-map-de24a6bf7c2c)
41
+
42
+ For a really deep dive you can try the book [Concurrency in Go](http://shop.oreilly.com/product/0636920046189.do) by [@kat-co](https://github.com/kat-co).
43
+
44
+
10
45
  ## Running the tests
11
46
 
12
47
  To run the tests run the command `go test` from within the exercise directory.
@@ -1,7 +1,10 @@
1
1
  ## No Stub
2
2
 
3
- This is the first exercise in the Go track that doesn't have a stub file; a pre-existing
4
- `raindrops.go` file to get you started on your solution.
3
+ This may be the first Go track exercise you encounter without a stub: a
4
+ pre-existing `raindrops.go` file for your solution. You may not see stubs in
5
+ the future and should begin to get comfortable with creating your own Go files
6
+ for your solutions.
5
7
 
6
- You won't see any stub files in the future and should start getting comfortable
7
- creating your own Go files for your solutions.
8
+ One way to figure out what the function signature(s) you would need is to look
9
+ at the corresponding \*\_test.go file. It will show you what the package level
10
+ functions(s) should be that the test will use to verify the solution.
@@ -17,6 +17,18 @@ Convert a number to a string, the contents of which depend on the number's facto
17
17
  - 34 has four factors: 1, 2, 17, and 34.
18
18
  - In raindrop-speak, this would be "34".
19
19
 
20
+ ## No Stub
21
+
22
+ This may be the first Go track exercise you encounter without a stub: a
23
+ pre-existing `raindrops.go` file for your solution. You may not see stubs in
24
+ the future and should begin to get comfortable with creating your own Go files
25
+ for your solutions.
26
+
27
+ One way to figure out what the function signature(s) you would need is to look
28
+ at the corresponding \*\_test.go file. It will show you what the package level
29
+ functions(s) should be that the test will use to verify the solution.
30
+
31
+
20
32
  ## Running the tests
21
33
 
22
34
  To run the tests run the command `go test` from within the exercise directory.
@@ -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
- Number int
24
+ Input struct {
25
+ Number int
26
+ }
25
27
  Expected string
26
28
  }
27
29
  }
@@ -38,6 +40,6 @@ type romanNumeralTest struct {
38
40
  }
39
41
 
40
42
  var romanNumeralTests = []romanNumeralTest {
41
- {{range .J.Cases}}{ {{.Number}}, "{{.Expected}}", false},
43
+ {{range .J.Cases}}{ {{.Input.Number}}, "{{.Expected}}", false},
42
44
  {{end}}}
43
45
  `
@@ -1,8 +1,8 @@
1
1
  package romannumerals
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 070e8d5 roman-numerals: Fix canonical-data.json formatting
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: 3c78ac4 Add test case for input value 49 to test double-normalization
5
+ // Problem Specifications Version: 1.2.0
6
6
 
7
7
  type romanNumeralTest struct {
8
8
  arabic int
@@ -20,6 +20,7 @@ var romanNumeralTests = []romanNumeralTest{
20
20
  {9, "IX", false},
21
21
  {27, "XXVII", false},
22
22
  {48, "XLVIII", false},
23
+ {49, "XLIX", false},
23
24
  {59, "LIX", false},
24
25
  {93, "XCIII", false},
25
26
  {141, "CXLI", false},
@@ -0,0 +1,10 @@
1
+ ## No Stub
2
+
3
+ This may be the first Go track exercise you encounter without a stub: a
4
+ pre-existing `space_age.go` file for your solution. You may not see stubs in
5
+ the future and should begin to get comfortable with creating your own Go files
6
+ for your solutions.
7
+
8
+ One way to figure out what the function signature(s) you would need is to look
9
+ at the corresponding \*\_test.go file. It will show you what the package level
10
+ functions(s) should be that the test will use to verify the solution.
@@ -12,11 +12,24 @@ Given an age in seconds, calculate how old someone would be on:
12
12
  - Neptune: orbital period 164.79132 Earth years
13
13
 
14
14
  So if you were told someone were 1,000,000,000 seconds old, you should
15
- be able to say that they're 31.69 Earth-years old.
15
+ be able to say that they're 31.69 Earth-years old. Round all ages to
16
+ the nearest hundredth of a year.
16
17
 
17
18
  If you're wondering why Pluto didn't make the cut, go watch [this
18
19
  youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
19
20
 
21
+ ## No Stub
22
+
23
+ This may be the first Go track exercise you encounter without a stub: a
24
+ pre-existing `space_age.go` file for your solution. You may not see stubs in
25
+ the future and should begin to get comfortable with creating your own Go files
26
+ for your solutions.
27
+
28
+ One way to figure out what the function signature(s) you would need is to look
29
+ at the corresponding \*\_test.go file. It will show you what the package level
30
+ functions(s) should be that the test will use to verify the solution.
31
+
32
+
20
33
  ## Running the tests
21
34
 
22
35
  To run the tests run the command `go test` from within the exercise directory.
@@ -28,10 +28,6 @@ On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping,
28
28
  On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
29
29
  ```
30
30
 
31
- ## No Stub
32
- This is the first Go track exercise you encounter without a stub: a pre-existing "twelve-days.go" file for your solution. You may not see stubs in the future and should begin to get comfortable with creating your own Go files for your solutions.
33
-
34
-
35
31
  ## Running the tests
36
32
 
37
33
  To run the tests run the command `go test` from within the exercise directory.
@@ -51,7 +47,8 @@ you're having trouble, please visit the exercism.io [Go language page](http://ex
51
47
 
52
48
  ## Source
53
49
 
54
- Wikipedia [http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)](http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song))
50
+ Wikipedia [http://en.wikipedia.org/wiki/The*Twelve_Days_of_Christmas*(song)](<http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)>)
55
51
 
56
52
  ## Submitting Incomplete Solutions
53
+
57
54
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,62 @@
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("two-bucket", &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
+ Input struct {
26
+ BucketOne int
27
+ BucketTwo int
28
+ Goal int
29
+ StartBucket string
30
+ }
31
+ Expected struct {
32
+ GoalBucket string
33
+ Moves int
34
+ OtherBucket int
35
+ }
36
+ }
37
+ }
38
+
39
+ // template applied to above data structure generates the Go test cases
40
+ var tmpl = `package twobucket
41
+
42
+ {{.Header}}
43
+
44
+ type bucketTestCase struct {
45
+ description string
46
+ bucketOne int
47
+ bucketTwo int
48
+ goal int
49
+ startBucket string
50
+ goalBucket string
51
+ moves int
52
+ otherBucket int
53
+ errorExpected bool // always false for generated test cases.
54
+ }
55
+
56
+ var testCases = []bucketTestCase {
57
+ {{range .J.Cases}}{
58
+ "{{.Description}}",
59
+ {{.Input.BucketOne}}, {{.Input.BucketTwo}}, {{.Input.Goal}}, "{{.Input.StartBucket}}", "{{.Expected.GoalBucket}}", {{.Expected.Moves}}, {{.Expected.OtherBucket}}, false,
60
+ },
61
+ {{end}}}
62
+ `