trackler 2.2.1.137 → 2.2.1.138

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/diffie-hellman/canonical-data.json +72 -0
  4. data/problem-specifications/exercises/yacht/description.md +2 -2
  5. data/tracks/csharp/exercises/sgf-parsing/Example.cs +1 -1
  6. data/tracks/csharp/exercises/sgf-parsing/SgfParsingTest.cs +1 -1
  7. data/tracks/csharp/exercises/sublist/SublistTest.cs +37 -78
  8. data/tracks/csharp/generators/Exercises/Sublist.cs +32 -0
  9. data/tracks/elisp/exercises/bob/README.md +2 -0
  10. data/tracks/elisp/exercises/bob/bob-test.el +60 -15
  11. data/tracks/elisp/exercises/bob/example.el +15 -5
  12. data/tracks/elisp/exercises/hamming/hamming-test.el +1 -1
  13. data/tracks/fsharp/build.ps1 +3 -3
  14. data/tracks/fsharp/build.sh +3 -3
  15. data/tracks/fsharp/exercises/bracket-push/BracketPushTest.fs +5 -1
  16. data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifierTest.fs +5 -1
  17. data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGardenTest.fs +1 -1
  18. data/tracks/fsharp/exercises/pov/PovTest.fs +6 -1
  19. data/tracks/fsharp/exercises/react/Example.fs +2 -2
  20. data/tracks/fsharp/exercises/react/React.fsproj +1 -0
  21. data/tracks/fsharp/exercises/react/ReactTest.fs +55 -33
  22. data/tracks/fsharp/exercises/series/Example.fs +2 -12
  23. data/tracks/fsharp/exercises/series/SeriesTest.fs +33 -56
  24. data/tracks/fsharp/generators/Generators.fs +81 -46
  25. data/tracks/idris/exercises/rna-transcription/src/{example.idr → Example.idr} +0 -0
  26. data/tracks/java/config.json +14 -0
  27. data/tracks/java/exercises/acronym/src/test/java/AcronymTest.java +10 -10
  28. data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +39 -39
  29. data/tracks/java/exercises/grep/.meta/hints.md +58 -0
  30. data/tracks/java/exercises/grep/.meta/src/reference/java/GrepTool.java +65 -0
  31. data/tracks/java/exercises/grep/.meta/version +1 -0
  32. data/tracks/java/exercises/grep/README.md +145 -0
  33. data/tracks/java/exercises/grep/build.gradle +18 -0
  34. data/tracks/java/exercises/grep/src/main/java/.keep +0 -0
  35. data/tracks/java/exercises/grep/src/test/java/GrepToolTest.java +395 -0
  36. data/tracks/java/exercises/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java +36 -36
  37. data/tracks/java/exercises/minesweeper/src/test/java/MinesweeperBoardTest.java +36 -36
  38. data/tracks/java/exercises/phone-number/src/test/java/PhoneNumberTest.java +14 -14
  39. data/tracks/java/exercises/poker/src/test/java/PokerTest.java +40 -40
  40. data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +10 -10
  41. data/tracks/java/exercises/settings.gradle +1 -0
  42. data/tracks/ocaml/exercises/anagram/example.ml +1 -1
  43. data/tracks/ocaml/exercises/change/example.ml +1 -1
  44. data/tracks/ocaml/exercises/custom-set/example.ml +4 -3
  45. data/tracks/ocaml/exercises/custom-set/test.ml +0 -1
  46. data/tracks/ocaml/exercises/dominoes/test.ml +1 -1
  47. data/tracks/ocaml/exercises/etl/example.ml +1 -1
  48. data/tracks/ocaml/exercises/grade-school/example.ml +1 -1
  49. data/tracks/ocaml/exercises/palindrome-products/example.ml +2 -2
  50. data/tracks/ocaml/exercises/prime-factors/example.ml +1 -1
  51. data/tracks/ocaml/exercises/robot-name/test.ml +1 -1
  52. data/tracks/ocaml/exercises/triangle/example.ml +1 -1
  53. data/tracks/ocaml/make-exercise.sh +1 -0
  54. data/tracks/ocaml/tools/test-generator/src/controller.ml +1 -1
  55. data/tracks/perl5/exercises/raindrops/.meta/solutions/Raindrops.pm +13 -12
  56. data/tracks/perl5/exercises/raindrops/raindrops.t +166 -111
  57. data/tracks/perl6/docs/INSTALLATION.md +1 -3
  58. data/tracks/perl6/exercises/raindrops/.meta/exercise-data.yaml +5 -5
  59. data/tracks/perl6/exercises/raindrops/.meta/solutions/Raindrops.pm6 +2 -2
  60. data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +2 -2
  61. data/tracks/perl6/exercises/raindrops/raindrops.t +3 -3
  62. data/tracks/python/exercises/food-chain/example.py +11 -2
  63. data/tracks/python/exercises/food-chain/food_chain_test.py +48 -45
  64. data/tracks/python/exercises/pov/pov_test.py +12 -1
  65. data/tracks/python/exercises/series/README.md +6 -6
  66. data/tracks/python/exercises/series/example.py +2 -3
  67. data/tracks/python/exercises/series/series_test.py +27 -28
  68. data/tracks/python/exercises/sgf-parsing/example.py +1 -1
  69. data/tracks/python/exercises/sgf-parsing/sgf_parsing_test.py +1 -1
  70. data/tracks/python/exercises/yacht/README.md +2 -2
  71. data/tracks/ruby/Gemfile +0 -1
  72. data/tracks/ruby/README.md +23 -0
  73. data/tracks/ruby/bin/generate +1 -0
  74. data/tracks/ruby/exercises/complex-numbers/complex_numbers_test.rb +1 -1
  75. data/tracks/ruby/lib/generator.rb +1 -2
  76. data/tracks/ruby/lib/generator/command_line.rb +3 -0
  77. data/tracks/ruby/lib/generator/command_line/generator_optparser.rb +1 -0
  78. data/tracks/ruby/lib/generator/exercise.rb +2 -0
  79. data/tracks/ruby/lib/generator/exercise_case.rb +3 -0
  80. data/tracks/ruby/lib/generator/files.rb +1 -0
  81. data/tracks/ruby/lib/generator/files/metadata_files.rb +2 -0
  82. data/tracks/ruby/lib/generator/files/track_files.rb +1 -0
  83. data/tracks/ruby/lib/generator/implementation.rb +1 -0
  84. data/tracks/ruby/lib/generator/repository.rb +3 -0
  85. data/tracks/ruby/lib/generator/template_values.rb +1 -0
  86. data/tracks/ruby/test/generator/case_values_test.rb +2 -0
  87. data/tracks/ruby/test/generator/command_line_test.rb +1 -0
  88. data/tracks/ruby/test/generator/files/metadata_files_test.rb +2 -0
  89. data/tracks/ruby/test/generator/files/track_files_test.rb +1 -0
  90. data/tracks/ruby/test/generator/implementation_test.rb +1 -0
  91. data/tracks/ruby/test/tasks/exercise_test.rb +1 -0
  92. data/tracks/ruby/test/tasks/exercise_test_tasks_test.rb +2 -0
  93. data/tracks/ruby/test/test_helper.rb +1 -3
  94. data/tracks/rust/config.json +12 -0
  95. data/tracks/rust/exercises/atbash-cipher/src/lib.rs +9 -0
  96. data/tracks/rust/exercises/hamming/src/lib.rs +6 -0
  97. data/tracks/rust/exercises/isogram/src/lib.rs +3 -0
  98. data/tracks/rust/exercises/luhn/src/lib.rs +4 -0
  99. data/tracks/rust/exercises/palindrome-products/.meta/test-in-release-mode +1 -0
  100. data/tracks/rust/exercises/palindrome-products/Cargo.toml +6 -0
  101. data/tracks/rust/exercises/palindrome-products/README.md +72 -0
  102. data/tracks/rust/exercises/palindrome-products/example.rs +25 -0
  103. data/tracks/rust/exercises/palindrome-products/src/lib.rs +22 -0
  104. data/tracks/rust/exercises/palindrome-products/tests/palindrome-products.rs +57 -0
  105. data/tracks/rust/exercises/pangram/src/lib.rs +4 -0
  106. data/tracks/rust/exercises/run-length-encoding/src/lib.rs +7 -0
  107. data/tracks/rust/exercises/say/src/lib.rs +3 -4
  108. data/tracks/rust/exercises/scrabble-score/src/lib.rs +4 -0
  109. data/tracks/rust/exercises/word-count/src/lib.rs +6 -0
  110. data/tracks/scheme/exercises/hello-world/example.scm +1 -4
  111. data/tracks/scheme/exercises/hello-world/hello-world-test.scm +1 -5
  112. data/tracks/scheme/exercises/scrabble-score/scrabble-score-test.scm +2 -2
  113. data/tracks/typescript/config.json +30 -0
  114. data/tracks/typescript/exercises/queen-attack/README.md +59 -0
  115. data/tracks/typescript/exercises/queen-attack/package.json +36 -0
  116. data/tracks/typescript/exercises/queen-attack/queen-attack.example.ts +56 -0
  117. data/tracks/typescript/exercises/queen-attack/queen-attack.test.ts +71 -0
  118. data/tracks/typescript/exercises/queen-attack/queen-attack.ts +0 -0
  119. data/tracks/typescript/exercises/queen-attack/tsconfig.json +22 -0
  120. data/tracks/typescript/exercises/queen-attack/tslint.json +127 -0
  121. data/tracks/typescript/exercises/queen-attack/yarn.lock +2624 -0
  122. data/tracks/typescript/exercises/spiral-matrix/README.md +56 -0
  123. data/tracks/typescript/exercises/spiral-matrix/package.json +36 -0
  124. data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.example.ts +33 -0
  125. data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts +49 -0
  126. data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.ts +0 -0
  127. data/tracks/typescript/exercises/spiral-matrix/tsconfig.json +22 -0
  128. data/tracks/typescript/exercises/spiral-matrix/tslint.json +127 -0
  129. data/tracks/typescript/exercises/spiral-matrix/yarn.lock +2624 -0
  130. metadata +35 -3
@@ -1,4 +1,2 @@
1
1
  ## Installing Rakudo Star
2
- The [How to get Rakudo Perl 6](http://rakudo.org/how-to-get-rakudo/) page contains detailed instructions for downloading and installing Rakudo Star for Windows / Mac OS X / Linux.
3
-
4
- If you are familiar with [Docker](https://www.docker.com/) there is an official [rakudo-star](https://hub.docker.com/_/rakudo-star/) Docker image available.
2
+ The [Rakudo Perl 6 Files](https://rakudo.org/files) page contains detailed instructions for downloading and installing Rakudo Star for Windows / Mac OS X / Linux.
@@ -1,18 +1,18 @@
1
1
  exercise: Raindrops
2
- version: 2
2
+ version: 3
3
3
  plan: 18
4
4
  tests: |-
5
5
  for @($c-data<cases>) {
6
6
  subtest {
7
7
  plan 2;
8
- is .<input><number>.&convert, |.<expected description>;
9
- isa-ok .<input><number>.&convert, Str;
8
+ is .<input><number>.&raindrop, |.<expected description>;
9
+ isa-ok .<input><number>.&raindrop, Str;
10
10
  }
11
11
  }
12
12
 
13
13
  unit: module
14
14
  example: |-
15
- sub convert (Int:D $num --> Str:D) is export {
15
+ sub raindrop (Int:D $num --> Str:D) is export {
16
16
  my $str = '';
17
17
  given $num {
18
18
  when * %% 3 {$str ~= 'Pling'; proceed}
@@ -22,5 +22,5 @@ example: |-
22
22
  return $str ?? $str !! $num.Str;
23
23
  }
24
24
  stub: |-
25
- sub convert ($num) is export {
25
+ sub raindrop ($num) is export {
26
26
  }
@@ -1,6 +1,6 @@
1
- unit module Raindrops:ver<2>;
1
+ unit module Raindrops:ver<3>;
2
2
 
3
- sub convert (Int:D $num --> Str:D) is export {
3
+ sub raindrop (Int:D $num --> Str:D) is export {
4
4
  my $str = '';
5
5
  given $num {
6
6
  when * %% 3 {$str ~= 'Pling'; proceed}
@@ -1,4 +1,4 @@
1
- unit module Raindrops:ver<2>;
1
+ unit module Raindrops:ver<3>;
2
2
 
3
- sub convert ($num) is export {
3
+ sub raindrop ($num) is export {
4
4
  }
@@ -6,7 +6,7 @@ use lib $?FILE.IO.dirname;
6
6
  use Raindrops;
7
7
  plan 18;
8
8
 
9
- my Version:D $version = v2;
9
+ my Version:D $version = v3;
10
10
 
11
11
  if Raindrops.^ver !~~ $version {
12
12
  warn "\nExercise version mismatch. Further tests may fail!"
@@ -18,8 +18,8 @@ my $c-data = from-json $=pod.pop.contents;
18
18
  for @($c-data<cases>) {
19
19
  subtest {
20
20
  plan 2;
21
- is .<input><number>.&convert, |.<expected description>;
22
- isa-ok .<input><number>.&convert, Str;
21
+ is .<input><number>.&raindrop, |.<expected description>;
22
+ isa-ok .<input><number>.&raindrop, Str;
23
23
  }
24
24
  }
25
25
 
@@ -50,5 +50,14 @@ def verses(letter):
50
50
 
51
51
 
52
52
  def recite(start_verse, end_verse):
53
- generated = [verse.replace("\n", "") for verse in verses(chain())]
54
- return generated[start_verse-1:end_verse]
53
+ generated = [verse.strip().split("\n") for verse in verses(chain())]
54
+ if start_verse == end_verse:
55
+ return generated[start_verse-1]
56
+ else:
57
+ result = []
58
+ for i in range(start_verse-1, end_verse):
59
+ result += generated[i] + [""]
60
+
61
+ # Pop out the last empty string
62
+ result.pop()
63
+ return result
@@ -9,98 +9,101 @@ class FoodChainTest(unittest.TestCase):
9
9
 
10
10
  def test_fly(self):
11
11
  expected = [
12
- "I know an old lady who swallowed a fly."
13
- "I don't know why she swallowed the fly. Perhaps she'll die."
12
+ "I know an old lady who swallowed a fly.",
13
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
14
14
  ]
15
15
  self.assertEqual(recite(1, 1), expected)
16
16
 
17
17
  def test_spider(self):
18
18
  expected = [
19
- "I know an old lady who swallowed a spider."
20
- "It wriggled and jiggled and tickled inside her."
21
- "She swallowed the spider to catch the fly."
22
- "I don't know why she swallowed the fly. Perhaps she'll die."
19
+ "I know an old lady who swallowed a spider.",
20
+ "It wriggled and jiggled and tickled inside her.",
21
+ "She swallowed the spider to catch the fly.",
22
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
23
23
  ]
24
24
  self.assertEqual(recite(2, 2), expected)
25
25
 
26
26
  def test_bird(self):
27
27
  expected = [
28
- "I know an old lady who swallowed a bird."
29
- "How absurd to swallow a bird!"
28
+ "I know an old lady who swallowed a bird.",
29
+ "How absurd to swallow a bird!",
30
30
  "She swallowed the bird to catch the spider that "
31
- "wriggled and jiggled and tickled inside her."
32
- "She swallowed the spider to catch the fly."
33
- "I don't know why she swallowed the fly. Perhaps she'll die."
31
+ "wriggled and jiggled and tickled inside her.",
32
+ "She swallowed the spider to catch the fly.",
33
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
34
34
  ]
35
35
  self.assertEqual(recite(3, 3), expected)
36
36
 
37
37
  def test_cat(self):
38
38
  expected = [
39
- "I know an old lady who swallowed a cat."
40
- "Imagine that, to swallow a cat!"
41
- "She swallowed the cat to catch the bird."
39
+ "I know an old lady who swallowed a cat.",
40
+ "Imagine that, to swallow a cat!",
41
+ "She swallowed the cat to catch the bird.",
42
42
  "She swallowed the bird to catch the spider that "
43
- "wriggled and jiggled and tickled inside her."
44
- "She swallowed the spider to catch the fly."
45
- "I don't know why she swallowed the fly. Perhaps she'll die."
43
+ "wriggled and jiggled and tickled inside her.",
44
+ "She swallowed the spider to catch the fly.",
45
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
46
46
  ]
47
47
  self.assertEqual(recite(4, 4), expected)
48
48
 
49
49
  def test_dog(self):
50
50
  expected = [
51
- "I know an old lady who swallowed a dog."
52
- "What a hog, to swallow a dog!"
53
- "She swallowed the dog to catch the cat."
54
- "She swallowed the cat to catch the bird."
51
+ "I know an old lady who swallowed a dog.",
52
+ "What a hog, to swallow a dog!",
53
+ "She swallowed the dog to catch the cat.",
54
+ "She swallowed the cat to catch the bird.",
55
55
  "She swallowed the bird to catch the spider that wriggled "
56
- "and jiggled and tickled inside her."
57
- "She swallowed the spider to catch the fly."
58
- "I don't know why she swallowed the fly. Perhaps she'll die."
56
+ "and jiggled and tickled inside her.",
57
+ "She swallowed the spider to catch the fly.",
58
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
59
59
  ]
60
60
  self.assertEqual(recite(5, 5), expected)
61
61
 
62
62
  def test_goat(self):
63
63
  expected = [
64
- "I know an old lady who swallowed a goat."
65
- "Just opened her throat and swallowed a goat!"
66
- "She swallowed the goat to catch the dog."
67
- "She swallowed the dog to catch the cat."
68
- "She swallowed the cat to catch the bird."
64
+ "I know an old lady who swallowed a goat.",
65
+ "Just opened her throat and swallowed a goat!",
66
+ "She swallowed the goat to catch the dog.",
67
+ "She swallowed the dog to catch the cat.",
68
+ "She swallowed the cat to catch the bird.",
69
69
  "She swallowed the bird to catch the spider that "
70
- "wriggled and jiggled and tickled inside her."
71
- "She swallowed the spider to catch the fly."
72
- "I don't know why she swallowed the fly. Perhaps she'll die."
70
+ "wriggled and jiggled and tickled inside her.",
71
+ "She swallowed the spider to catch the fly.",
72
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
73
73
  ]
74
74
  self.assertEqual(recite(6, 6), expected)
75
75
 
76
76
  def test_cow(self):
77
77
  expected = [
78
- "I know an old lady who swallowed a cow."
79
- "I don't know how she swallowed a cow!"
80
- "She swallowed the cow to catch the goat."
81
- "She swallowed the goat to catch the dog."
82
- "She swallowed the dog to catch the cat."
83
- "She swallowed the cat to catch the bird."
78
+ "I know an old lady who swallowed a cow.",
79
+ "I don't know how she swallowed a cow!",
80
+ "She swallowed the cow to catch the goat.",
81
+ "She swallowed the goat to catch the dog.",
82
+ "She swallowed the dog to catch the cat.",
83
+ "She swallowed the cat to catch the bird.",
84
84
  "She swallowed the bird to catch the spider that "
85
- "wriggled and jiggled and tickled inside her."
86
- "She swallowed the spider to catch the fly."
87
- "I don't know why she swallowed the fly. Perhaps she'll die."
85
+ "wriggled and jiggled and tickled inside her.",
86
+ "She swallowed the spider to catch the fly.",
87
+ "I don't know why she swallowed the fly. Perhaps she'll die.",
88
88
  ]
89
89
  self.assertEqual(recite(7, 7), expected)
90
90
 
91
91
  def test_horse(self):
92
92
  expected = [
93
- "I know an old lady who swallowed a horse."
94
- "She's dead, of course!"
93
+ "I know an old lady who swallowed a horse.",
94
+ "She's dead, of course!",
95
95
  ]
96
96
  self.assertEqual(recite(8, 8), expected)
97
97
 
98
98
  def test_multiple_verses(self):
99
- expected = [recite(n, n)[0] for n in range(1, 4)]
99
+ expected = recite(1, 1) + [""] + recite(2, 2) + [""] + recite(3, 3)
100
100
  self.assertEqual(recite(1, 3), expected)
101
101
 
102
102
  def test_full_song(self):
103
- expected = [recite(n, n)[0] for n in range(1, 9)]
103
+ expected = []
104
+ for n in range(1, 9):
105
+ expected += recite(n, n) + [""]
106
+ expected.pop()
104
107
  self.assertEqual(recite(1, 8), expected)
105
108
 
106
109
 
@@ -3,7 +3,7 @@ import unittest
3
3
  from pov import Tree
4
4
 
5
5
 
6
- # Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
6
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.3.0
7
7
 
8
8
  class PovTest(unittest.TestCase):
9
9
 
@@ -158,6 +158,17 @@ class PovTest(unittest.TestCase):
158
158
  expected = ['x', 'parent', 'grandparent', 'uncle', 'cousin-1']
159
159
  self.assertEqual(tree.path_to('x', 'cousin-1'), expected)
160
160
 
161
+ def test_can_find_path_not_involving_root(self):
162
+ tree = Tree('grandparent', [
163
+ Tree('parent', [
164
+ Tree('x'),
165
+ Tree('sibling-0'),
166
+ Tree('sibling-1')
167
+ ])
168
+ ])
169
+ expected = ['x', 'parent', 'sibling-1']
170
+ self.assertEqual(tree.path_to('x', 'sibling-1'), expected)
171
+
161
172
  def test_can_find_path_from_nodes_other_than_x(self):
162
173
  tree = Tree('parent', [
163
174
  Tree('a'),
@@ -1,18 +1,18 @@
1
1
  # Series
2
2
 
3
3
  Given a string of digits, output all the contiguous substrings of length `n` in
4
- that string.
4
+ that string in the order that they appear.
5
5
 
6
6
  For example, the string "49142" has the following 3-digit series:
7
7
 
8
- - 491
9
- - 914
10
- - 142
8
+ - "491"
9
+ - "914"
10
+ - "142"
11
11
 
12
12
  And the following 4-digit series:
13
13
 
14
- - 4914
15
- - 9142
14
+ - "4914"
15
+ - "9142"
16
16
 
17
17
  And if you ask for a 6-digit series from a 5-digit string, you deserve
18
18
  whatever you get.
@@ -1,6 +1,5 @@
1
1
  def slices(series, length):
2
- numbers = [int(digit) for digit in series]
3
- if not 1 <= length <= len(numbers):
2
+ if not 1 <= length <= len(series):
4
3
  raise ValueError("Invalid slice length for this series: " + str(
5
4
  length))
6
- return [numbers[i:i + length] for i in range(len(numbers) - length + 1)]
5
+ return [series[i:i + length] for i in range(len(series) - length + 1)]
@@ -9,40 +9,39 @@ import unittest
9
9
  from series import slices
10
10
 
11
11
 
12
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
13
+
12
14
  class SeriesTest(unittest.TestCase):
13
- def test_slices_of_one(self):
14
- self.assertEqual(
15
- slices("01234", 1),
16
- [[0], [1], [2], [3], [4]], )
15
+ def test_slices_of_one_from_one(self):
16
+ self.assertEqual(slices("1", 1), ["1"])
17
+
18
+ def test_slices_of_one_from_two(self):
19
+ self.assertEqual(slices("12", 1), ["1", "2"])
17
20
 
18
21
  def test_slices_of_two(self):
19
- self.assertEqual(
20
- slices("97867564", 2),
21
- [[9, 7], [7, 8], [8, 6], [6, 7], [7, 5], [5, 6], [6, 4]], )
22
-
23
- def test_slices_of_three(self):
24
- self.assertEqual(
25
- slices("97867564", 3),
26
- [[9, 7, 8], [7, 8, 6], [8, 6, 7], [6, 7, 5], [7, 5, 6], [5, 6, 4]],
27
- )
28
-
29
- def test_slices_of_four(self):
30
- self.assertEqual(
31
- slices("01234", 4),
32
- [[0, 1, 2, 3], [1, 2, 3, 4]], )
33
-
34
- def test_slices_of_five(self):
35
- self.assertEqual(
36
- slices("01234", 5),
37
- [[0, 1, 2, 3, 4]], )
38
-
39
- def test_overly_long_slice(self):
22
+ self.assertEqual(slices("35", 2), ["35"])
23
+
24
+ def test_slices_of_two_overlap(self):
25
+ self.assertEqual(slices("9142", 2), ["91", "14", "42"])
26
+
27
+ def test_slices_can_include_duplicates(self):
28
+ self.assertEqual(slices("777777", 3), ["777", "777", "777", "777"])
29
+
30
+ def test_slice_length_is_too_large(self):
31
+ with self.assertRaisesWithMessage(ValueError):
32
+ slices("12345", 6)
33
+
34
+ def test_slice_length_cannot_be_zero(self):
35
+ with self.assertRaisesWithMessage(ValueError):
36
+ slices("12345", 0)
37
+
38
+ def test_slice_length_cannot_be_negative(self):
40
39
  with self.assertRaisesWithMessage(ValueError):
41
- slices("012", 4)
40
+ slices("123", -1)
42
41
 
43
- def test_overly_short_slice(self):
42
+ def test_empty_series_is_invalid(self):
44
43
  with self.assertRaisesWithMessage(ValueError):
45
- slices("01234", 0)
44
+ slices("", 1)
46
45
 
47
46
  # Utility functions
48
47
  def setUp(self):
@@ -66,7 +66,7 @@ def parse(input_string):
66
66
  if stack[0] == '\\':
67
67
  stack.pop(0)
68
68
  ch = stack.pop(0)
69
- return ' ' if ch in '\n\t' else ch
69
+ return ' ' if ch in ['\t'] else ch
70
70
 
71
71
  def peek():
72
72
  return stack[0]
@@ -75,7 +75,7 @@ class SgfParsingTest(unittest.TestCase):
75
75
  def test_escaped_property(self):
76
76
  input_string = '(;A[\]b\nc\nd\t\te \n\]])'
77
77
  expected = SgfTree(
78
- properties={'A': [']b c d e ]']}
78
+ properties={'A': [']b\nc\nd e \n]']}
79
79
  )
80
80
  self.assertEqual(parse(input_string), expected)
81
81
 
@@ -19,7 +19,7 @@ category chosen.
19
19
  Sixes 6 × number of sixes 2 3 4 5 6 scores 6
20
20
  Full House Total of the dice 3 3 3 5 5 scores 19
21
21
  Four of a Kind Total of the four dice 4 4 4 4 6 scores 16
22
- Little Straight 30 points 1 2 3 4 5 scores 30
22
+ Little Straight 30 points 1 2 3 4 5 scores 30
23
23
  Big Straight 30 points 2 3 4 5 6 scores 30
24
24
  Choice Sum of the dice 2 3 3 4 6 scores 18
25
25
  Yacht 50 points 4 4 4 4 4 scores 50
@@ -28,7 +28,7 @@ If the dice do not satisfy the requirements of a category, the score is zero.
28
28
  If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero
29
29
  points are scored. A *Yacht* scores zero if entered in the *Full House* category.
30
30
 
31
- ## Task
31
+ ## Task
32
32
  Given a list of values for five dice and a category, your solution should return
33
33
  the score of the dice for that category. If the dice do not satisfy the requirements
34
34
  of the category your solution should return 0. You can assume that five values
@@ -2,6 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'minitest'
4
4
  gem 'rake'
5
- gem 'require_all'
6
5
  gem 'rubocop', '0.36.0'
7
6
  gem 'simplecov'
@@ -109,6 +109,29 @@ tree -L 1 ~/code/exercism
109
109
  ├── problem-specifications
110
110
  └── ruby
111
111
  ```
112
+ To explain a bit more, you must follow this commands step-by-step:-
113
+
114
+ ``` bash
115
+ $ mkdir exercism
116
+ $ cd exercism
117
+ ```
118
+ Fork the [exercism/ruby](https://github.com/exercism/ruby)
119
+
120
+ Fork the [exercism/problem-specifications](https://github.com/exercism/problem-specifications)
121
+
122
+ Now you need to clone both the above repositories
123
+ ``` bash
124
+
125
+ $ git clone https://github.com/YOUR-USERNAME/YOUR-RUBY-REPOSITORY
126
+ $ git clone https://github.com/YOUR-USERNAME/YOUR-PROBLEM-S-REPOSITORY
127
+
128
+ ```
129
+ Next, you need to [configure the remote](https://help.github.com/articles/configuring-a-remote-for-a-fork/) and [synchronize](https://help.github.com/articles/syncing-a-fork/) it.
130
+
131
+ Make sure you have synced up local master branch and upstream master branch.
132
+ Since this will keep local master branch up-to-date with the upstream repository.
133
+ Thereby, you will able to get the latest commits.
134
+
112
135
 
113
136
  #### Regenerating a Test Suite
114
137
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative '../lib/helper'
4
4
  require 'generator'
5
+ require 'generator/command_line'
5
6
 
6
7
  paths = Generator::Paths.new(track: EXERCISM_RUBY_ROOT, metadata: METADATA_REPOSITORY_PATH)
7
8