trackler 2.2.1.19 → 2.2.1.20
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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/config.json +11 -0
- data/tracks/bash/docs/ABOUT.md +5 -0
- data/tracks/bash/exercises/word-count/README.md +24 -0
- data/tracks/bash/exercises/word-count/example.awk +12 -0
- data/tracks/bash/exercises/word-count/example.sh +21 -0
- data/tracks/bash/exercises/word-count/word_count_test.sh +84 -0
- data/tracks/coffeescript/config/maintainers.json +5 -11
- data/tracks/csharp/.travis.yml +3 -0
- data/tracks/delphi/config/maintainers.json +1 -1
- data/tracks/ecmascript/config.json +108 -108
- data/tracks/elixir/exercises/phone-number/phone_number_test.exs +21 -1
- data/tracks/factor/docs/SNIPPET.txt +5 -0
- data/tracks/idris/docs/TESTS.md +7 -0
- data/tracks/java/config.json +47 -47
- data/tracks/javascript/config.json +103 -103
- data/tracks/julia/config.json +121 -121
- data/tracks/julia/docs/RESOURCES.md +1 -1
- data/tracks/julia/docs/SNIPPET.txt +8 -0
- data/tracks/objective-c/config.json +2 -3
- data/tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m +11 -32
- data/tracks/ocaml/.travis-ci.sh +1 -1
- data/tracks/ocaml/.travis.yml +1 -1
- data/tracks/ocaml/README.md +1 -1
- data/tracks/ocaml/exercises/change/test.ml +24 -21
- data/tracks/ocaml/tools/test-generator/src/codegen.ml +3 -7
- data/tracks/ocaml/tools/test-generator/src/controller.ml +4 -5
- data/tracks/ocaml/tools/test-generator/src/languages.ml +4 -3
- data/tracks/ocaml/tools/test-generator/src/model.ml +1 -2
- data/tracks/ocaml/tools/test-generator/src/ocaml_special_cases.ml +19 -18
- data/tracks/ocaml/tools/test-generator/src/parser.ml +12 -17
- data/tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml +11 -3
- data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +2 -3
- data/tracks/ocaml/tools/test-generator/test/ocaml_special_cases_test.ml +12 -4
- data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -10
- data/tracks/purescript/exercises/bob/test/Main.purs +5 -5
- data/tracks/ruby/bin/generate +1 -1
- data/tracks/ruby/docs/24pullrequests.md +1 -1
- data/tracks/ruby/exercises/all-your-base/all_your_base_test.rb +24 -24
- data/tracks/ruby/exercises/alphametics/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/bowling/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/bowling/bowling_test.rb +10 -10
- data/tracks/ruby/exercises/change/.meta/.version +1 -1
- data/tracks/ruby/exercises/change/.meta/solutions/change.rb +1 -1
- data/tracks/ruby/exercises/change/change_test.rb +7 -2
- data/tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb +1 -1
- data/tracks/ruby/exercises/connect/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/dominoes/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/hamming/.meta/generator/hamming_case.rb +5 -1
- data/tracks/ruby/exercises/hamming/hamming_test.rb +7 -7
- data/tracks/ruby/exercises/leap/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/pangram/.meta/.version +1 -1
- data/tracks/ruby/exercises/pangram/.meta/solutions/pangram.rb +1 -1
- data/tracks/ruby/exercises/pangram/pangram_test.rb +3 -3
- data/tracks/ruby/exercises/rna-transcription/rna_transcription_test.rb +4 -4
- data/tracks/ruby/exercises/roman-numerals/.meta/solutions/roman_numerals.rb +1 -1
- data/tracks/ruby/exercises/space-age/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/lib/generator/test_template.erb +1 -1
- data/tracks/ruby/lib/generator/underscore.rb +1 -1
- data/tracks/ruby/lib/helper.rb +4 -4
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha-beta/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/.version +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/generator/alpha_case.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/solutions/alpha.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/beta/.meta/.version +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/beta/.meta/generator/beta_case.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/lib/generator/test_template.erb +1 -1
- data/tracks/ruby/test/generator/files/track_files_test.rb +4 -4
- data/tracks/ruby/test/generator/implementation_test.rb +1 -1
- data/tracks/ruby/test/generator/template_values_test.rb +1 -1
- data/tracks/scala/exercises/rail-fence-cipher/src/main/scala/{RailFenceCipher.scala → .keep} +0 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala +16 -23
- data/tracks/scala/exercises/say/src/test/scala/SayTest.scala +20 -33
- data/tracks/scala/testgen/src/main/scala/RailFenceCipherTestGenerator.scala +9 -53
- data/tracks/scala/testgen/src/main/scala/SayTestGenerator.scala +50 -0
- data/tracks/sml/bin/generate +1 -1
- data/tracks/sml/config.json +30 -0
- data/tracks/sml/exercises/all-your-base/README.md +61 -0
- data/tracks/sml/exercises/all-your-base/all-your-base.sml +2 -0
- data/tracks/sml/exercises/all-your-base/example.sml +36 -0
- data/tracks/sml/exercises/all-your-base/test.sml +75 -0
- data/tracks/sml/exercises/all-your-base/testlib.sml +159 -0
- data/tracks/sml/exercises/difference-of-squares/example.sml +3 -6
- data/tracks/sml/exercises/list-ops/README.md +40 -0
- data/tracks/sml/exercises/list-ops/example.sml +34 -0
- data/tracks/sml/exercises/list-ops/list-ops.sml +23 -0
- data/tracks/sml/exercises/list-ops/test.sml +85 -0
- data/tracks/sml/exercises/list-ops/testlib.sml +159 -0
- data/tracks/sml/exercises/prime-factors/README.md +66 -0
- data/tracks/sml/exercises/prime-factors/example.sml +15 -0
- data/tracks/sml/exercises/prime-factors/prime-factors.sml +2 -0
- data/tracks/sml/exercises/prime-factors/test.sml +35 -0
- data/tracks/sml/exercises/prime-factors/testlib.sml +159 -0
- metadata +34 -11
|
@@ -15,10 +15,6 @@ let stringify = function
|
|
|
15
15
|
| _ -> failwith "Bad type for stringify"
|
|
16
16
|
|
|
17
17
|
let ocaml_special_cases_tests = [
|
|
18
|
-
"for a non special cased slug convert the parameter to a string" >:: (fun _ctx ->
|
|
19
|
-
assert_equal ~printer:Fn.id "stringified" @@ ocaml_edit_expected ~stringify ~slug:"some-slug" ~value:(`Bool true)
|
|
20
|
-
);
|
|
21
|
-
|
|
22
18
|
"an optional int parameter is converted to none if it matches the special value" >:: (fun _ctx ->
|
|
23
19
|
assert_equal "None" @@ optional_int ~none:88 (`Int 88)
|
|
24
20
|
);
|
|
@@ -40,4 +36,16 @@ let ocaml_special_cases_tests = [
|
|
|
40
36
|
assert_equal ~printer:tuples_printer [("key", "(Some \"value\")"); ("key2", "\"value2\"")]
|
|
41
37
|
@@ optional_strings ~f:(fun x -> x = "key") [("key", `String "value"); ("key2", `String "value2")]
|
|
42
38
|
);
|
|
39
|
+
|
|
40
|
+
"option_of_null converts Null to None" >:: (fun _ctx ->
|
|
41
|
+
assert_equal "None" @@ option_of_null `Null
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
"option_of_null converts String to Some" >:: (fun _ctx ->
|
|
45
|
+
assert_equal "(Some \"abc\")" @@ option_of_null (`String "abc")
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
"option_of_null converts List to Some" >:: (fun _ctx ->
|
|
49
|
+
assert_equal "(Some [1; 2; 3])" @@ option_of_null (`List [`Int 1;`Int 2;`Int 3])
|
|
50
|
+
);
|
|
43
51
|
]
|
|
@@ -7,7 +7,7 @@ let ae exp got _test_ctxt = assert_equal exp got
|
|
|
7
7
|
|
|
8
8
|
let single x = Ok (Single x)
|
|
9
9
|
|
|
10
|
-
let call_parser json = parse_json_text json "
|
|
10
|
+
let call_parser json = parse_json_text json "cases" |> Result.map ~f:(fun c -> c.tests)
|
|
11
11
|
|
|
12
12
|
let parser_tests = [
|
|
13
13
|
"gives an error with a json map that does not have the key cases in" >::
|
|
@@ -23,35 +23,35 @@ let parser_tests = [
|
|
|
23
23
|
(call_parser "{\"cases\" : [\"key\"]}");
|
|
24
24
|
|
|
25
25
|
"parses a single element with a description and expected string output" >::
|
|
26
|
-
ae (single [{description = "d1"; parameters = [
|
|
26
|
+
ae (single [{description = "d1"; parameters = [("expected", `String "value")]}])
|
|
27
27
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : \"value\"}]}");
|
|
28
28
|
|
|
29
29
|
"parses a single element with a description and expected float output" >::
|
|
30
|
-
ae (single [{description = "d1"; parameters = [
|
|
30
|
+
ae (single [{description = "d1"; parameters = [("expected", `Float 100.)]}])
|
|
31
31
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : 100.0}]}");
|
|
32
32
|
|
|
33
33
|
"parses a single element with a description and expected bool output" >::
|
|
34
|
-
ae (single [{description = "d1"; parameters = [
|
|
34
|
+
ae (single [{description = "d1"; parameters = [("expected", `Bool true)];}])
|
|
35
35
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : true}]}");
|
|
36
36
|
|
|
37
37
|
"parses a single element with a description and expected int list output" >::
|
|
38
|
-
ae (single [{description = "d1"; parameters = [
|
|
38
|
+
ae (single [{description = "d1"; parameters = [("expected", `List [`Int 1;`Int 2;`Int 3])]}])
|
|
39
39
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : [1, 2, 3]}]}");
|
|
40
40
|
|
|
41
41
|
"parses a single element with a description and expected null output" >::
|
|
42
|
-
ae (single [{description = "d1"; parameters = [
|
|
42
|
+
ae (single [{description = "d1"; parameters = [("expected", `Null)]}])
|
|
43
43
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : null}]}");
|
|
44
44
|
|
|
45
45
|
"parses a single element with an int key value pair" >::
|
|
46
|
-
ae (single [{description = "d1"; parameters = [("input", `Int 1996)
|
|
46
|
+
ae (single [{description = "d1"; parameters = [("input", `Int 1996); ("expected", `Bool true)]}])
|
|
47
47
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"input\" : 1996, \"expected\" : true}]}");
|
|
48
48
|
|
|
49
49
|
"parses a single element with a string key value pair" >::
|
|
50
|
-
ae (single [{description = "d1"; parameters = [("input", `String "some-string")
|
|
50
|
+
ae (single [{description = "d1"; parameters = [("input", `String "some-string"); ("expected", `Int 85)]}])
|
|
51
51
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"input\" : \"some-string\", \"expected\" : 85}]}");
|
|
52
52
|
|
|
53
53
|
"parses a single element with a string list key value pair" >::
|
|
54
|
-
ae (single [{description = "d1"; parameters = [("input", `List [`String "s1"; `String "s2"])
|
|
54
|
+
ae (single [{description = "d1"; parameters = [("input", `List [`String "s1"; `String "s2"]); ("expected", `Int 85)]}])
|
|
55
55
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"input\" : [\"s1\", \"s2\"], \"expected\" : 85}]}");
|
|
56
56
|
|
|
57
57
|
"an element without a description is an Error" >::
|
|
@@ -67,7 +67,7 @@ let parser_tests = [
|
|
|
67
67
|
(call_parser "{\"cases\" : [{\"input\" : 11}]}");
|
|
68
68
|
|
|
69
69
|
"parses a map in the expected parameter" >::(fun _ctx ->
|
|
70
|
-
assert_equal (single [{description = "d1"; parameters = [
|
|
70
|
+
assert_equal (single [{description = "d1"; parameters = [("expected", `Assoc [("one", `Int 1); ("two", `Int 2)])]}])
|
|
71
71
|
(call_parser "{\"cases\" : [{\"description\" : \"d1\", \"expected\" : {\"one\": 1, \"two\": 2}}]}");
|
|
72
72
|
);
|
|
73
73
|
|
|
@@ -14,7 +14,7 @@ main = runTest do
|
|
|
14
14
|
Bob.hey "Tom-ay-totom-aaaah-to."
|
|
15
15
|
|
|
16
16
|
test "shouting" do
|
|
17
|
-
Assert.equal "
|
|
17
|
+
Assert.equal "Whoa, chill out!" $
|
|
18
18
|
Bob.hey "WATCH OUT!"
|
|
19
19
|
|
|
20
20
|
test "asking a question" do
|
|
@@ -34,11 +34,11 @@ main = runTest do
|
|
|
34
34
|
Bob.hey "It's OK if you don't want to go to the DMV."
|
|
35
35
|
|
|
36
36
|
test "forceful questions" do
|
|
37
|
-
Assert.equal "
|
|
37
|
+
Assert.equal "Whoa, chill out!" $
|
|
38
38
|
Bob.hey "WHAT THE HELL WERE YOU THINKING?"
|
|
39
39
|
|
|
40
40
|
test "shouting numbers" do
|
|
41
|
-
Assert.equal "
|
|
41
|
+
Assert.equal "Whoa, chill out!" $
|
|
42
42
|
Bob.hey "12, 3 GO!"
|
|
43
43
|
|
|
44
44
|
test "only numbers" do
|
|
@@ -50,11 +50,11 @@ main = runTest do
|
|
|
50
50
|
Bob.hey "4?"
|
|
51
51
|
|
|
52
52
|
test "shouting with special characters" do
|
|
53
|
-
Assert.equal "
|
|
53
|
+
Assert.equal "Whoa, chill out!" $
|
|
54
54
|
Bob.hey "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"
|
|
55
55
|
|
|
56
56
|
test "shouting with no exclamation mark" do
|
|
57
|
-
Assert.equal "
|
|
57
|
+
Assert.equal "Whoa, chill out!" $
|
|
58
58
|
Bob.hey "I HATE YOU"
|
|
59
59
|
|
|
60
60
|
test "statement containing a question mark" do
|
data/tracks/ruby/bin/generate
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require_relative '../lib/helper'
|
|
4
4
|
require 'generator'
|
|
5
5
|
|
|
6
|
-
paths = Generator::Paths.new(track:
|
|
6
|
+
paths = Generator::Paths.new(track: EXERCISM_RUBY_ROOT, metadata: METADATA_REPOSITORY_PATH)
|
|
7
7
|
|
|
8
8
|
generators = Generator::CommandLine.new(paths).parse(ARGV)
|
|
9
9
|
exit 1 unless generators
|
|
@@ -18,4 +18,4 @@ Something missing? Create a pull request!
|
|
|
18
18
|
|
|
19
19
|
Check out the [Getting Involved in a Track](https://github.com/exercism/exercism.io/blob/master/docs/getting-involved-in-a-track.md) documentation, and some [ideas for things we are looking for](http://exercism.io/languages/ruby/todo) for exercises that are needed to be implemented.
|
|
20
20
|
|
|
21
|
-
We are available to answer questions in the [](https://gitter.im/exercism/ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'minitest/autorun'
|
|
2
2
|
require_relative 'all_your_base'
|
|
3
3
|
|
|
4
|
-
# Common test data version: 1.
|
|
4
|
+
# Common test data version: 1.1.0 c4d8d95
|
|
5
5
|
class AllYourBaseTest < Minitest::Test
|
|
6
6
|
def test_single_bit_one_to_decimal
|
|
7
7
|
# skip
|
|
@@ -171,10 +171,10 @@ class AllYourBaseTest < Minitest::Test
|
|
|
171
171
|
"Expected #{expected} but got #{converted}."
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
-
def
|
|
174
|
+
def test_first_base_is_one
|
|
175
175
|
skip
|
|
176
|
-
digits = [
|
|
177
|
-
input_base =
|
|
176
|
+
digits = []
|
|
177
|
+
input_base = 1
|
|
178
178
|
output_base = 10
|
|
179
179
|
|
|
180
180
|
assert_raises ArgumentError do
|
|
@@ -182,10 +182,10 @@ class AllYourBaseTest < Minitest::Test
|
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
-
def
|
|
185
|
+
def test_first_base_is_zero
|
|
186
186
|
skip
|
|
187
|
-
digits = [
|
|
188
|
-
input_base =
|
|
187
|
+
digits = []
|
|
188
|
+
input_base = 0
|
|
189
189
|
output_base = 10
|
|
190
190
|
|
|
191
191
|
assert_raises ArgumentError do
|
|
@@ -193,10 +193,10 @@ class AllYourBaseTest < Minitest::Test
|
|
|
193
193
|
end
|
|
194
194
|
end
|
|
195
195
|
|
|
196
|
-
def
|
|
196
|
+
def test_first_base_is_negative
|
|
197
197
|
skip
|
|
198
|
-
digits = []
|
|
199
|
-
input_base =
|
|
198
|
+
digits = [1]
|
|
199
|
+
input_base = -2
|
|
200
200
|
output_base = 10
|
|
201
201
|
|
|
202
202
|
assert_raises ArgumentError do
|
|
@@ -204,21 +204,21 @@ class AllYourBaseTest < Minitest::Test
|
|
|
204
204
|
end
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
-
def
|
|
207
|
+
def test_negative_digit
|
|
208
208
|
skip
|
|
209
|
-
digits = [1,
|
|
209
|
+
digits = [1, -1, 1, 0, 1, 0]
|
|
210
210
|
input_base = 2
|
|
211
|
-
output_base =
|
|
211
|
+
output_base = 10
|
|
212
212
|
|
|
213
213
|
assert_raises ArgumentError do
|
|
214
214
|
BaseConverter.convert(input_base, digits, output_base)
|
|
215
215
|
end
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
def
|
|
218
|
+
def test_invalid_positive_digit
|
|
219
219
|
skip
|
|
220
|
-
digits = []
|
|
221
|
-
input_base =
|
|
220
|
+
digits = [1, 2, 1, 0, 1, 0]
|
|
221
|
+
input_base = 2
|
|
222
222
|
output_base = 10
|
|
223
223
|
|
|
224
224
|
assert_raises ArgumentError do
|
|
@@ -226,22 +226,22 @@ class AllYourBaseTest < Minitest::Test
|
|
|
226
226
|
end
|
|
227
227
|
end
|
|
228
228
|
|
|
229
|
-
def
|
|
229
|
+
def test_second_base_is_one
|
|
230
230
|
skip
|
|
231
|
-
digits = [
|
|
232
|
-
input_base =
|
|
233
|
-
output_base =
|
|
231
|
+
digits = [1, 0, 1, 0, 1, 0]
|
|
232
|
+
input_base = 2
|
|
233
|
+
output_base = 1
|
|
234
234
|
|
|
235
235
|
assert_raises ArgumentError do
|
|
236
236
|
BaseConverter.convert(input_base, digits, output_base)
|
|
237
237
|
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
-
def
|
|
240
|
+
def test_second_base_is_zero
|
|
241
241
|
skip
|
|
242
|
-
digits = [
|
|
243
|
-
input_base =
|
|
244
|
-
output_base =
|
|
242
|
+
digits = [7]
|
|
243
|
+
input_base = 10
|
|
244
|
+
output_base = 0
|
|
245
245
|
|
|
246
246
|
assert_raises ArgumentError do
|
|
247
247
|
BaseConverter.convert(input_base, digits, output_base)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'minitest/autorun'
|
|
2
2
|
require_relative 'bowling'
|
|
3
3
|
|
|
4
|
-
# Common test data version: 1.0.
|
|
4
|
+
# Common test data version: 1.0.1 26e345e
|
|
5
5
|
class BowlingTest < Minitest::Test
|
|
6
6
|
def setup
|
|
7
7
|
@game = Game.new
|
|
@@ -95,7 +95,7 @@ class BowlingTest < Minitest::Test
|
|
|
95
95
|
assert_equal 300, @game.score
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
def
|
|
98
|
+
def test_rolls_cannot_score_negative_points
|
|
99
99
|
skip
|
|
100
100
|
record([])
|
|
101
101
|
assert_raises Game::BowlingError do
|
|
@@ -103,7 +103,7 @@ class BowlingTest < Minitest::Test
|
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
def
|
|
106
|
+
def test_a_roll_cannot_score_more_than_10_points
|
|
107
107
|
skip
|
|
108
108
|
record([])
|
|
109
109
|
assert_raises Game::BowlingError do
|
|
@@ -111,7 +111,7 @@ class BowlingTest < Minitest::Test
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
def
|
|
114
|
+
def test_two_rolls_in_a_frame_cannot_score_more_than_10_points
|
|
115
115
|
skip
|
|
116
116
|
record([5])
|
|
117
117
|
assert_raises Game::BowlingError do
|
|
@@ -119,7 +119,7 @@ class BowlingTest < Minitest::Test
|
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
def
|
|
122
|
+
def test_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points
|
|
123
123
|
skip
|
|
124
124
|
record([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10])
|
|
125
125
|
assert_raises Game::BowlingError do
|
|
@@ -127,7 +127,7 @@ class BowlingTest < Minitest::Test
|
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
def
|
|
130
|
+
def test_two_bonus_rolls_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points
|
|
131
131
|
skip
|
|
132
132
|
record([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5])
|
|
133
133
|
assert_raises Game::BowlingError do
|
|
@@ -141,7 +141,7 @@ class BowlingTest < Minitest::Test
|
|
|
141
141
|
assert_equal 26, @game.score
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
def
|
|
144
|
+
def test_the_second_bonus_rolls_after_a_strike_in_the_last_frame_cannot_be_a_strike_if_the_first_one_is_not_a_strike
|
|
145
145
|
skip
|
|
146
146
|
record([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6])
|
|
147
147
|
assert_raises Game::BowlingError do
|
|
@@ -149,7 +149,7 @@ class BowlingTest < Minitest::Test
|
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
def
|
|
152
|
+
def test_second_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points
|
|
153
153
|
skip
|
|
154
154
|
record([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10])
|
|
155
155
|
assert_raises Game::BowlingError do
|
|
@@ -157,7 +157,7 @@ class BowlingTest < Minitest::Test
|
|
|
157
157
|
end
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
-
def
|
|
160
|
+
def test_an_unstarted_game_cannot_be_scored
|
|
161
161
|
skip
|
|
162
162
|
record([])
|
|
163
163
|
assert_raises Game::BowlingError do
|
|
@@ -165,7 +165,7 @@ class BowlingTest < Minitest::Test
|
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
def
|
|
168
|
+
def test_an_incomplete_game_cannot_be_scored
|
|
169
169
|
skip
|
|
170
170
|
record([0, 0])
|
|
171
171
|
assert_raises Game::BowlingError do
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'minitest/autorun'
|
|
2
2
|
require_relative 'change'
|
|
3
3
|
|
|
4
|
-
# Common test data version: 1.
|
|
4
|
+
# Common test data version: 1.1.0 52cf1cf
|
|
5
5
|
class ChangeTest < Minitest::Test
|
|
6
6
|
def test_single_coin_change
|
|
7
7
|
# skip
|
|
@@ -33,6 +33,11 @@ class ChangeTest < Minitest::Test
|
|
|
33
33
|
assert_equal [2, 2, 2, 5, 10], Change.generate([2, 5, 10, 20, 50], 21)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def test_another_possible_change_without_unit_coins_available
|
|
37
|
+
skip
|
|
38
|
+
assert_equal [4, 4, 4, 5, 5, 5], Change.generate([4, 5], 27)
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
def test_no_coins_make_0_change
|
|
37
42
|
skip
|
|
38
43
|
assert_equal [], Change.generate([1, 5, 10, 21, 25], 0)
|
|
@@ -72,6 +77,6 @@ class ChangeTest < Minitest::Test
|
|
|
72
77
|
|
|
73
78
|
def test_bookkeeping
|
|
74
79
|
skip
|
|
75
|
-
assert_equal
|
|
80
|
+
assert_equal 2, BookKeeping::VERSION
|
|
76
81
|
end
|
|
77
82
|
end
|
|
@@ -2,7 +2,7 @@ require 'generator/exercise_case'
|
|
|
2
2
|
|
|
3
3
|
class HammingCase < Generator::ExerciseCase
|
|
4
4
|
def workload
|
|
5
|
-
if
|
|
5
|
+
if expects_error?
|
|
6
6
|
assert_raises(ArgumentError) { test_case }
|
|
7
7
|
else
|
|
8
8
|
assert_equal { test_case }
|
|
@@ -14,4 +14,8 @@ class HammingCase < Generator::ExerciseCase
|
|
|
14
14
|
def test_case
|
|
15
15
|
"Hamming.compute('#{strand1}', '#{strand2}')"
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def expects_error?
|
|
19
|
+
expected.is_a? Hash
|
|
20
|
+
end
|
|
17
21
|
end
|