trackler 2.1.0.0 → 2.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/connect/description.md +2 -1
- data/common/exercises/crypto-square/canonical-data.json +2 -2
- data/common/exercises/two-bucket/canonical-data.json +27 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/exercises/perfect-numbers/src/example.c +8 -4
- data/tracks/clojure/config.json +5 -0
- data/tracks/clojure/exercises/secret-handshake/project.clj +4 -0
- data/tracks/clojure/exercises/secret-handshake/src/example.clj +19 -0
- data/tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj +55 -0
- data/tracks/cpp/.travis.yml +4 -3
- data/tracks/cpp/README.md +1 -1
- data/tracks/cpp/config.json +171 -67
- data/tracks/cpp/docs/ABOUT.md +2 -2
- data/tracks/cpp/docs/INSTALLATION.md +22 -28
- data/tracks/cpp/docs/TESTS.md +1 -1
- data/tracks/cpp/exercises/anagram/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/beer-song/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/binary/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/bob/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/clock/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/clock/clock_test.cpp +188 -64
- data/tracks/cpp/exercises/clock/example.cpp +17 -12
- data/tracks/cpp/exercises/clock/example.h +1 -0
- data/tracks/cpp/exercises/crypto-square/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/difference-of-squares/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/etl/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/etl/etl_test.cpp +5 -5
- data/tracks/cpp/exercises/food-chain/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/gigasecond/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/gigasecond/example.cpp +2 -6
- data/tracks/cpp/exercises/gigasecond/example.h +2 -2
- data/tracks/cpp/exercises/gigasecond/gigasecond_test.cpp +26 -8
- data/tracks/cpp/exercises/grade-school/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/grade-school/grade_school_test.cpp +5 -6
- data/tracks/cpp/exercises/grains/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hamming/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hello-world/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hexadecimal/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/leap/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/meetup/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/meetup/meetup_test.cpp +1 -1
- data/tracks/cpp/exercises/nth-prime/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/nucleotide-count/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/nucleotide-count/nucleotide_count_test.cpp +3 -4
- data/tracks/cpp/exercises/phone-number/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/prime-factors/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/queen-attack/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/raindrops/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/rna-transcription/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/robot-name/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/roman-numerals/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/say/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/scrabble-score/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/series/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/series/series_test.cpp +11 -11
- data/tracks/cpp/exercises/sieve/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/space-age/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/sum-of-multiples/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/triangle/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/trinary/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/word-count/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/word-count/word_count_test.cpp +14 -15
- data/tracks/go/README.md +27 -13
- data/tracks/go/config.json +1 -0
- data/tracks/go/exercises/connect/.meta/gen.go +1 -3
- data/tracks/go/exercises/connect/cases_test.go +2 -1
- data/tracks/go/exercises/custom-set/.meta/gen.go +122 -101
- data/tracks/go/exercises/custom-set/cases_test.go +13 -4
- data/tracks/go/exercises/custom-set/custom_set_test.go +2 -2
- data/tracks/go/exercises/hamming/.meta/gen.go +1 -3
- data/tracks/go/exercises/hamming/cases_test.go +7 -1
- data/tracks/go/exercises/hamming/example.go +1 -1
- data/tracks/go/exercises/hamming/hamming_test.go +1 -1
- data/tracks/go/exercises/hello-world/{hello_example_test.go → example_helloworld_test.go} +0 -0
- data/tracks/go/exercises/house/house_test.go +8 -8
- data/tracks/go/exercises/meetup/.meta/gen.go +1 -3
- data/tracks/go/exercises/meetup/cases_test.go +2 -1
- data/tracks/go/exercises/palindrome-products/example.go +1 -1
- data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +1 -1
- data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +24 -4
- data/tracks/go/exercises/rna-transcription/.meta/gen.go +1 -3
- data/tracks/go/exercises/rna-transcription/cases_test.go +2 -1
- data/tracks/go/exercises/roman-numerals/.meta/gen.go +1 -3
- data/tracks/go/exercises/roman-numerals/cases_test.go +2 -1
- data/tracks/go/exercises/roman-numerals/example.go +1 -1
- data/tracks/go/exercises/transpose/.meta/gen.go +1 -3
- data/tracks/go/exercises/transpose/cases_test.go +2 -1
- data/tracks/go/exercises/transpose/transpose_test.go +5 -0
- data/tracks/go/exercises/word-count/.meta/gen.go +1 -3
- data/tracks/go/exercises/word-count/cases_test.go +2 -1
- data/tracks/go/gen/gen.go +3 -2
- data/tracks/java/config.json +5 -0
- data/tracks/java/exercises/saddle-points/build.gradle +17 -0
- data/tracks/java/exercises/saddle-points/src/example/java/Matrix.java +44 -0
- data/tracks/java/exercises/saddle-points/src/example/java/MatrixCoordinate.java +31 -0
- data/tracks/java/exercises/saddle-points/src/main/java/Matrix.java +5 -0
- data/tracks/java/exercises/saddle-points/src/main/java/MatrixCoordinate.java +31 -0
- data/tracks/java/exercises/saddle-points/src/test/java/MatrixTest.java +82 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/.travis.yml +3 -1
- data/tracks/javascript/Makefile +2 -8
- data/tracks/javascript/SETUP.md +1 -2
- data/tracks/javascript/docs/INSTALLATION.md +3 -4
- data/tracks/javascript/docs/TESTS.md +14 -26
- data/tracks/javascript/exercises/hamming/example.js +7 -11
- data/tracks/javascript/exercises/hello-world/HINTS.md +3 -3
- data/tracks/javascript/exercises/robot-simulator/example.js +72 -73
- data/tracks/perl6/config.json +5 -0
- data/tracks/perl6/exercises/clock/Clock.pm6 +4 -0
- data/tracks/perl6/exercises/clock/Example.pm6 +12 -0
- data/tracks/perl6/exercises/clock/clock.t +534 -0
- data/tracks/perl6/exercises/clock/example.yaml +16 -0
- data/tracks/perl6/exercises/robot-name/Example.pm +11 -4
- data/tracks/php/exercises/hello-world/hello-world.php +1 -1
- data/tracks/php/exercises/hello-world/hello-world_test.php +1 -11
- data/tracks/php/exercises/robot-name/robot-name_test.php +1 -0
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/largest-series-product/bower.json +16 -0
- data/tracks/purescript/exercises/largest-series-product/examples/src/LargestSeriesProduct.purs +31 -0
- data/tracks/purescript/exercises/largest-series-product/src/LargestSeriesProduct.purs +3 -0
- data/tracks/purescript/exercises/largest-series-product/test/Main.purs +73 -0
- data/tracks/python/exercises/sublist/sublist_test.py +94 -55
- data/tracks/ruby/README.md +38 -25
- data/tracks/ruby/exercises/hamming/example.tt +6 -4
- data/tracks/ruby/exercises/hamming/hamming_test.rb +4 -5
- data/tracks/ruby/exercises/linked-list/linked_list_test.rb +16 -0
- data/tracks/ruby/exercises/luhn/luhn_test.rb +5 -5
- data/tracks/ruby/exercises/ocr-numbers/.meta/.version +1 -0
- data/tracks/ruby/exercises/ocr-numbers/example.rb +42 -61
- data/tracks/ruby/exercises/ocr-numbers/example.tt +21 -0
- data/tracks/ruby/exercises/ocr-numbers/ocr_numbers_test.rb +63 -138
- data/tracks/ruby/lib/generator/exercise_cases.rb +43 -0
- data/tracks/ruby/lib/generator/underscore.rb +9 -0
- data/tracks/ruby/lib/hamming_cases.rb +9 -14
- data/tracks/ruby/lib/luhn_cases.rb +2 -18
- data/tracks/ruby/lib/ocr_numbers_cases.rb +20 -0
- data/tracks/ruby/lib/pig_latin_cases.rb +2 -12
- data/tracks/ruby/test/generator/underscore_test.rb +23 -0
- data/tracks/scala/config.json +316 -316
- metadata +26 -10
- data/tracks/cpp/exercises/etl/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/grade-school/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/nucleotide-count/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/series/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/word-count/require_equal_containers.h +0 -88
- data/tracks/javascript/exercises/acronym/package.json +0 -12
- data/tracks/javascript/package.json +0 -12
@@ -4,14 +4,16 @@ require 'minitest/autorun'
|
|
4
4
|
require_relative 'hamming'
|
5
5
|
|
6
6
|
# Common test data version: <%= abbreviated_commit_hash %>
|
7
|
-
class HammingTest < Minitest::Test
|
7
|
+
class HammingTest < Minitest::Test
|
8
|
+
<% test_cases.each do |test_case| %>
|
8
9
|
def <%= test_case.name %>
|
9
|
-
<%= test_case.skipped
|
10
|
-
|
11
|
-
assert_equal <%= test_case.expected %>, <%= test_case.workload %><% end %>
|
10
|
+
<%= test_case.skipped %>
|
11
|
+
<%= test_case.workload %>
|
12
12
|
end
|
13
|
+
|
13
14
|
<% end %>
|
14
15
|
<%= IO.read(XRUBY_LIB + '/bookkeeping.md') %>
|
16
|
+
|
15
17
|
def test_bookkeeping
|
16
18
|
skip
|
17
19
|
assert_equal <%= version %>, BookKeeping::VERSION
|
@@ -3,9 +3,7 @@ gem 'minitest', '>= 5.0.0'
|
|
3
3
|
require 'minitest/autorun'
|
4
4
|
require_relative 'hamming'
|
5
5
|
|
6
|
-
#
|
7
|
-
# deb225e Implement canonical dataset for scrabble-score problem (#255)
|
8
|
-
|
6
|
+
# Common test data version: bb56dc7
|
9
7
|
class HammingTest < Minitest::Test
|
10
8
|
def test_identical_strands
|
11
9
|
# skip
|
@@ -88,8 +86,9 @@ class HammingTest < Minitest::Test
|
|
88
86
|
# not your solution.
|
89
87
|
#
|
90
88
|
# Define a constant named VERSION inside of the top level BookKeeping
|
91
|
-
# module.
|
92
|
-
#
|
89
|
+
# module, which may be placed near the end of your file.
|
90
|
+
#
|
91
|
+
# In your file, it will look like this:
|
93
92
|
#
|
94
93
|
# module BookKeeping
|
95
94
|
# VERSION = 1 # Where the version number matches the one in the test.
|
@@ -53,4 +53,20 @@ class DequeTest < Minitest::Test
|
|
53
53
|
assert_equal 50, deque.pop
|
54
54
|
assert_equal 30, deque.shift
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_pop_to_empty
|
58
|
+
deque = Deque.new
|
59
|
+
deque.push(10)
|
60
|
+
assert_equal 10, deque.pop
|
61
|
+
deque.push(20)
|
62
|
+
assert_equal 20, deque.shift
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_shift_to_empty
|
66
|
+
deque = Deque.new
|
67
|
+
deque.unshift(10)
|
68
|
+
assert_equal 10, deque.shift
|
69
|
+
deque.unshift(20)
|
70
|
+
assert_equal 20, deque.pop
|
71
|
+
end
|
56
72
|
end
|
@@ -10,27 +10,27 @@ class LuhnTest < Minitest::Test
|
|
10
10
|
refute Luhn.valid?("1")
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def test_a_single_zero_is_invalid
|
14
14
|
skip
|
15
15
|
refute Luhn.valid?("0")
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_a_simple_valid_sin_that_remains_valid_if_reversed
|
19
19
|
skip
|
20
20
|
assert Luhn.valid?("059")
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def test_a_simple_valid_sin_that_becomes_invalid_if_reversed
|
24
24
|
skip
|
25
25
|
assert Luhn.valid?("59")
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def test_a_valid_canadian_sin
|
29
29
|
skip
|
30
30
|
assert Luhn.valid?("055 444 285")
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def test_invalid_canadian_sin
|
34
34
|
skip
|
35
35
|
refute Luhn.valid?("055 444 286")
|
36
36
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
1
|
@@ -1,80 +1,61 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
class OcrNumbers
|
2
|
+
DIGITS = {
|
3
|
+
' _ | ||_| ' => '0',
|
4
|
+
' | | ' => '1',
|
5
|
+
' _ _||_ ' => '2',
|
6
|
+
' _ _| _| ' => '3',
|
7
|
+
' |_| | ' => '4',
|
8
|
+
' _ |_ _| ' => '5',
|
9
|
+
' _ |_ |_| ' => '6',
|
10
|
+
' _ | | ' => '7',
|
11
|
+
' _ |_||_| ' => '8',
|
12
|
+
' _ |_| _| ' => '9'
|
13
|
+
}
|
14
|
+
DIGITS.default = '?'
|
15
|
+
|
16
|
+
def self.convert(text)
|
17
|
+
OcrNumbers.new(text).convert
|
13
18
|
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
def format(numbers)
|
18
|
-
numbers.map(&:join).join(',')
|
20
|
+
def initialize(text)
|
21
|
+
@text = text
|
19
22
|
end
|
20
23
|
|
21
|
-
def
|
22
|
-
|
23
|
-
each_column do |column|
|
24
|
-
values << value_at(row, column)
|
25
|
-
end
|
26
|
-
values
|
27
|
-
end
|
24
|
+
def convert
|
25
|
+
raise ArgumentError unless valid?
|
28
26
|
|
29
|
-
|
30
|
-
(0...row_count).step(4) do |row|
|
31
|
-
yield row
|
32
|
-
end
|
27
|
+
numbers.map {|lines| decode(lines) }.join(',')
|
33
28
|
end
|
34
29
|
|
35
|
-
|
36
|
-
|
37
|
-
yield column
|
38
|
-
end
|
39
|
-
end
|
30
|
+
private
|
31
|
+
attr_reader :text
|
40
32
|
|
41
|
-
def
|
42
|
-
|
33
|
+
def valid?
|
34
|
+
(rows.size % 4).zero? &&
|
35
|
+
(first_row_width % 3).zero? &&
|
36
|
+
rows[1..-1].all? {|row| row.size == first_row_width }
|
43
37
|
end
|
44
38
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
text[row + 3][column, 3]
|
51
|
-
]
|
39
|
+
def decode(lines)
|
40
|
+
lines.map {|line| line.scan(/.../) }.
|
41
|
+
transpose.
|
42
|
+
map {|char_rows| DIGITS[char_rows.join] }.
|
43
|
+
join
|
52
44
|
end
|
53
45
|
|
54
|
-
def
|
55
|
-
text.
|
46
|
+
def numbers
|
47
|
+
text.split("\n").each_slice(4)
|
56
48
|
end
|
57
49
|
|
58
|
-
def
|
59
|
-
text.
|
50
|
+
def rows
|
51
|
+
@rows ||= text.split("\n")
|
60
52
|
end
|
61
53
|
|
62
|
-
def
|
63
|
-
|
54
|
+
def first_row_width
|
55
|
+
@first_row_width ||= rows.first.size
|
64
56
|
end
|
57
|
+
end
|
65
58
|
|
66
|
-
|
67
|
-
|
68
|
-
[' _ ', '| |', '|_|', ' '] => '0',
|
69
|
-
[' ', ' |', ' |', ' '] => '1',
|
70
|
-
[' _ ', ' _|', '|_ ', ' '] => '2',
|
71
|
-
[' _ ', ' _|', ' _|', ' '] => '3',
|
72
|
-
[' ', '|_|', ' |', ' '] => '4',
|
73
|
-
[' _ ', '|_ ', ' _|', ' '] => '5',
|
74
|
-
[' _ ', '|_ ', '|_|', ' '] => '6',
|
75
|
-
[' _ ', ' |', ' |', ' '] => '7',
|
76
|
-
[' _ ', '|_|', '|_|', ' '] => '8',
|
77
|
-
[' _ ', '|_|', ' _|', ' '] => '9'
|
78
|
-
}[pattern]
|
79
|
-
end
|
59
|
+
module BookKeeping
|
60
|
+
VERSION = 1
|
80
61
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
gem 'minitest', '>= 5.0.0'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require_relative 'ocr_numbers'
|
5
|
+
|
6
|
+
# Common test data version: <%= abbreviated_commit_hash %>
|
7
|
+
class OcrNumbersTest < Minitest::Test
|
8
|
+
<% test_cases.each do |test_case| %>
|
9
|
+
def <%= test_case.name %>
|
10
|
+
<%= test_case.skipped %>
|
11
|
+
<%= test_case.workload %>
|
12
|
+
end
|
13
|
+
|
14
|
+
<% end %>
|
15
|
+
<%= IO.read(XRUBY_LIB + '/bookkeeping.md') %>
|
16
|
+
|
17
|
+
def test_bookkeeping
|
18
|
+
skip
|
19
|
+
assert_equal <%= version %>, BookKeeping::VERSION
|
20
|
+
end
|
21
|
+
end
|
@@ -3,187 +3,112 @@ gem 'minitest', '>= 5.0.0'
|
|
3
3
|
require 'minitest/autorun'
|
4
4
|
require_relative 'ocr_numbers'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
| |
|
11
|
-
|_|
|
12
|
-
|
13
|
-
NUMBER
|
14
|
-
assert_equal '0', OCR.new(text).convert
|
6
|
+
# Common test data version: 80782b6
|
7
|
+
class OcrNumbersTest < Minitest::Test
|
8
|
+
def test_recognizes_0
|
9
|
+
# skip
|
10
|
+
assert_equal "0", OcrNumbers.convert(" _ \n| |\n|_|\n ")
|
15
11
|
end
|
16
12
|
|
17
|
-
def
|
13
|
+
def test_recognizes_1
|
18
14
|
skip
|
19
|
-
|
20
|
-
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
24
|
-
NUMBER
|
25
|
-
assert_equal '1', OCR.new(text).convert
|
15
|
+
assert_equal "1", OcrNumbers.convert(" \n |\n |\n ")
|
26
16
|
end
|
27
17
|
|
28
|
-
def
|
18
|
+
def test_unreadable_but_correctly_sized_inputs_return_?
|
29
19
|
skip
|
30
|
-
|
31
|
-
_
|
32
|
-
_|
|
33
|
-
|_
|
34
|
-
|
35
|
-
NUMBER
|
36
|
-
assert_equal '2', OCR.new(text).convert
|
20
|
+
assert_equal "?", OcrNumbers.convert(" \n _\n |\n ")
|
37
21
|
end
|
38
22
|
|
39
|
-
def
|
23
|
+
def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error
|
40
24
|
skip
|
41
|
-
|
42
|
-
_
|
43
|
-
_|
|
44
|
-
_|
|
45
|
-
|
46
|
-
NUMBER
|
47
|
-
assert_equal '3', OCR.new(text).convert
|
25
|
+
assert_raises(ArgumentError) { OcrNumbers.convert(" _ \n| |\n ") }
|
48
26
|
end
|
49
27
|
|
50
|
-
def
|
28
|
+
def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error
|
51
29
|
skip
|
52
|
-
|
53
|
-
|
54
|
-
|_|
|
55
|
-
|
|
56
|
-
|
57
|
-
NUMBER
|
58
|
-
assert_equal '4', OCR.new(text).convert
|
30
|
+
assert_raises(ArgumentError) { OcrNumbers.convert(" \n |\n |\n ") }
|
59
31
|
end
|
60
32
|
|
61
|
-
def
|
33
|
+
def test_recognizes_110101100
|
62
34
|
skip
|
63
|
-
|
64
|
-
_
|
65
|
-
|_
|
66
|
-
_|
|
67
|
-
|
68
|
-
NUMBER
|
69
|
-
assert_equal '5', OCR.new(text).convert
|
35
|
+
assert_equal "110101100", OcrNumbers.convert(" _ _ _ _ \n | || | || | | || || |\n | ||_| ||_| | ||_||_|\n ")
|
70
36
|
end
|
71
37
|
|
72
|
-
def
|
38
|
+
def test_garbled_numbers_in_a_string_are_replaced_with_?
|
73
39
|
skip
|
74
|
-
|
75
|
-
_
|
76
|
-
|_
|
77
|
-
|_|
|
78
|
-
|
79
|
-
NUMBER
|
80
|
-
assert_equal '6', OCR.new(text).convert
|
40
|
+
assert_equal "11?10?1?0", OcrNumbers.convert(" _ _ _ \n | || | || | || || |\n | | _| ||_| | ||_||_|\n ")
|
81
41
|
end
|
82
42
|
|
83
|
-
def
|
43
|
+
def test_recognizes_2
|
84
44
|
skip
|
85
|
-
|
86
|
-
_
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
90
|
-
NUMBER
|
91
|
-
assert_equal '7', OCR.new(text).convert
|
45
|
+
assert_equal "2", OcrNumbers.convert(" _ \n _|\n|_ \n ")
|
92
46
|
end
|
93
47
|
|
94
|
-
def
|
48
|
+
def test_recognizes_3
|
95
49
|
skip
|
96
|
-
|
97
|
-
_
|
98
|
-
|_|
|
99
|
-
|_|
|
100
|
-
|
101
|
-
NUMBER
|
102
|
-
assert_equal '8', OCR.new(text).convert
|
50
|
+
assert_equal "3", OcrNumbers.convert(" _ \n _|\n _|\n ")
|
103
51
|
end
|
104
52
|
|
105
|
-
def
|
53
|
+
def test_recognizes_4
|
106
54
|
skip
|
107
|
-
|
108
|
-
_
|
109
|
-
|_|
|
110
|
-
_|
|
111
|
-
|
112
|
-
NUMBER
|
113
|
-
assert_equal '9', OCR.new(text).convert
|
55
|
+
assert_equal "4", OcrNumbers.convert(" \n|_|\n |\n ")
|
114
56
|
end
|
115
57
|
|
116
|
-
def
|
58
|
+
def test_recognizes_5
|
117
59
|
skip
|
118
|
-
|
119
|
-
|
120
|
-
| |
|
121
|
-
| |
|
122
|
-
|
123
|
-
NUMBER
|
124
|
-
assert_equal '?', OCR.new(text).convert
|
60
|
+
assert_equal "5", OcrNumbers.convert(" _ \n|_ \n _|\n ")
|
125
61
|
end
|
126
62
|
|
127
|
-
def
|
63
|
+
def test_recognizes_6
|
128
64
|
skip
|
129
|
-
|
130
|
-
_
|
131
|
-
|| |
|
132
|
-
||_|
|
133
|
-
|
134
|
-
NUMBER
|
135
|
-
assert_equal '10', OCR.new(text).convert
|
65
|
+
assert_equal "6", OcrNumbers.convert(" _ \n|_ \n|_|\n ")
|
136
66
|
end
|
137
67
|
|
138
|
-
def
|
68
|
+
def test_recognizes_7
|
139
69
|
skip
|
140
|
-
|
141
|
-
_ _ _ _
|
142
|
-
| || | || | | || || |
|
143
|
-
| ||_| ||_| | ||_||_|
|
144
|
-
|
145
|
-
NUMBER
|
146
|
-
assert_equal '110101100', OCR.new(text).convert
|
70
|
+
assert_equal "7", OcrNumbers.convert(" _ \n |\n |\n ")
|
147
71
|
end
|
148
72
|
|
149
|
-
def
|
73
|
+
def test_recognizes_8
|
150
74
|
skip
|
151
|
-
|
152
|
-
_ _ _
|
153
|
-
| || | || | || || |
|
154
|
-
| | _| ||_| | ||_||_|
|
155
|
-
|
156
|
-
NUMBER
|
157
|
-
assert_equal '11?10?1?0', OCR.new(text).convert
|
75
|
+
assert_equal "8", OcrNumbers.convert(" _ \n|_|\n|_|\n ")
|
158
76
|
end
|
159
77
|
|
160
|
-
def
|
78
|
+
def test_recognizes_9
|
161
79
|
skip
|
162
|
-
|
163
|
-
_ _ _ _ _ _ _ _
|
164
|
-
| _| _||_||_ |_ ||_||_|| |
|
165
|
-
||_ _| | _||_| ||_| _||_|
|
166
|
-
|
167
|
-
NUMBER
|
168
|
-
assert_equal '1234567890', OCR.new(text).convert
|
80
|
+
assert_equal "9", OcrNumbers.convert(" _ \n|_|\n _|\n ")
|
169
81
|
end
|
170
82
|
|
171
|
-
def
|
172
|
-
skip
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
_ _
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
83
|
+
def test_recognizes_string_of_decimal_numbers
|
84
|
+
skip
|
85
|
+
assert_equal "1234567890", OcrNumbers.convert(" _ _ _ _ _ _ _ _ \n | _| _||_||_ |_ ||_||_|| |\n ||_ _| | _||_| ||_| _||_|\n ")
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_numbers_separated_by_empty_lines_are_recognized_lines_are_joined_by_commas
|
89
|
+
skip
|
90
|
+
assert_equal "123,456,789", OcrNumbers.convert(" _ _ \n | _| _|\n ||_ _|\n \n _ _ \n|_||_ |_ \n | _||_|\n \n _ _ _ \n ||_||_|\n ||_| _|\n ")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Problems in exercism evolve over time, as we find better ways to ask
|
94
|
+
# questions.
|
95
|
+
# The version number refers to the version of the problem you solved,
|
96
|
+
# not your solution.
|
97
|
+
#
|
98
|
+
# Define a constant named VERSION inside of the top level BookKeeping
|
99
|
+
# module, which may be placed near the end of your file.
|
100
|
+
#
|
101
|
+
# In your file, it will look like this:
|
102
|
+
#
|
103
|
+
# module BookKeeping
|
104
|
+
# VERSION = 1 # Where the version number matches the one in the test.
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# If you are curious, read more about constants on RubyDoc:
|
108
|
+
# http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
|
109
|
+
|
110
|
+
def test_bookkeeping
|
111
|
+
skip
|
112
|
+
assert_equal 1, BookKeeping::VERSION
|
188
113
|
end
|
189
114
|
end
|