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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/connect/description.md +2 -1
  3. data/common/exercises/crypto-square/canonical-data.json +2 -2
  4. data/common/exercises/two-bucket/canonical-data.json +27 -1
  5. data/lib/trackler/version.rb +1 -1
  6. data/tracks/c/exercises/perfect-numbers/src/example.c +8 -4
  7. data/tracks/clojure/config.json +5 -0
  8. data/tracks/clojure/exercises/secret-handshake/project.clj +4 -0
  9. data/tracks/clojure/exercises/secret-handshake/src/example.clj +19 -0
  10. data/tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj +55 -0
  11. data/tracks/cpp/.travis.yml +4 -3
  12. data/tracks/cpp/README.md +1 -1
  13. data/tracks/cpp/config.json +171 -67
  14. data/tracks/cpp/docs/ABOUT.md +2 -2
  15. data/tracks/cpp/docs/INSTALLATION.md +22 -28
  16. data/tracks/cpp/docs/TESTS.md +1 -1
  17. data/tracks/cpp/exercises/anagram/CMakeLists.txt +2 -9
  18. data/tracks/cpp/exercises/beer-song/CMakeLists.txt +2 -9
  19. data/tracks/cpp/exercises/binary/CMakeLists.txt +2 -9
  20. data/tracks/cpp/exercises/bob/CMakeLists.txt +2 -9
  21. data/tracks/cpp/exercises/clock/CMakeLists.txt +2 -9
  22. data/tracks/cpp/exercises/clock/clock_test.cpp +188 -64
  23. data/tracks/cpp/exercises/clock/example.cpp +17 -12
  24. data/tracks/cpp/exercises/clock/example.h +1 -0
  25. data/tracks/cpp/exercises/crypto-square/CMakeLists.txt +2 -9
  26. data/tracks/cpp/exercises/difference-of-squares/CMakeLists.txt +2 -9
  27. data/tracks/cpp/exercises/etl/CMakeLists.txt +2 -9
  28. data/tracks/cpp/exercises/etl/etl_test.cpp +5 -5
  29. data/tracks/cpp/exercises/food-chain/CMakeLists.txt +2 -9
  30. data/tracks/cpp/exercises/gigasecond/CMakeLists.txt +2 -9
  31. data/tracks/cpp/exercises/gigasecond/example.cpp +2 -6
  32. data/tracks/cpp/exercises/gigasecond/example.h +2 -2
  33. data/tracks/cpp/exercises/gigasecond/gigasecond_test.cpp +26 -8
  34. data/tracks/cpp/exercises/grade-school/CMakeLists.txt +2 -9
  35. data/tracks/cpp/exercises/grade-school/grade_school_test.cpp +5 -6
  36. data/tracks/cpp/exercises/grains/CMakeLists.txt +2 -9
  37. data/tracks/cpp/exercises/hamming/CMakeLists.txt +2 -9
  38. data/tracks/cpp/exercises/hello-world/CMakeLists.txt +2 -9
  39. data/tracks/cpp/exercises/hexadecimal/CMakeLists.txt +2 -9
  40. data/tracks/cpp/exercises/leap/CMakeLists.txt +2 -9
  41. data/tracks/cpp/exercises/meetup/CMakeLists.txt +2 -9
  42. data/tracks/cpp/exercises/meetup/meetup_test.cpp +1 -1
  43. data/tracks/cpp/exercises/nth-prime/CMakeLists.txt +2 -9
  44. data/tracks/cpp/exercises/nucleotide-count/CMakeLists.txt +2 -9
  45. data/tracks/cpp/exercises/nucleotide-count/nucleotide_count_test.cpp +3 -4
  46. data/tracks/cpp/exercises/phone-number/CMakeLists.txt +2 -9
  47. data/tracks/cpp/exercises/prime-factors/CMakeLists.txt +2 -9
  48. data/tracks/cpp/exercises/queen-attack/CMakeLists.txt +2 -9
  49. data/tracks/cpp/exercises/raindrops/CMakeLists.txt +2 -9
  50. data/tracks/cpp/exercises/rna-transcription/CMakeLists.txt +2 -9
  51. data/tracks/cpp/exercises/robot-name/CMakeLists.txt +2 -9
  52. data/tracks/cpp/exercises/roman-numerals/CMakeLists.txt +2 -9
  53. data/tracks/cpp/exercises/say/CMakeLists.txt +2 -9
  54. data/tracks/cpp/exercises/scrabble-score/CMakeLists.txt +2 -9
  55. data/tracks/cpp/exercises/series/CMakeLists.txt +2 -9
  56. data/tracks/cpp/exercises/series/series_test.cpp +11 -11
  57. data/tracks/cpp/exercises/sieve/CMakeLists.txt +2 -9
  58. data/tracks/cpp/exercises/space-age/CMakeLists.txt +2 -9
  59. data/tracks/cpp/exercises/sum-of-multiples/CMakeLists.txt +2 -9
  60. data/tracks/cpp/exercises/triangle/CMakeLists.txt +2 -9
  61. data/tracks/cpp/exercises/trinary/CMakeLists.txt +2 -9
  62. data/tracks/cpp/exercises/word-count/CMakeLists.txt +2 -9
  63. data/tracks/cpp/exercises/word-count/word_count_test.cpp +14 -15
  64. data/tracks/go/README.md +27 -13
  65. data/tracks/go/config.json +1 -0
  66. data/tracks/go/exercises/connect/.meta/gen.go +1 -3
  67. data/tracks/go/exercises/connect/cases_test.go +2 -1
  68. data/tracks/go/exercises/custom-set/.meta/gen.go +122 -101
  69. data/tracks/go/exercises/custom-set/cases_test.go +13 -4
  70. data/tracks/go/exercises/custom-set/custom_set_test.go +2 -2
  71. data/tracks/go/exercises/hamming/.meta/gen.go +1 -3
  72. data/tracks/go/exercises/hamming/cases_test.go +7 -1
  73. data/tracks/go/exercises/hamming/example.go +1 -1
  74. data/tracks/go/exercises/hamming/hamming_test.go +1 -1
  75. data/tracks/go/exercises/hello-world/{hello_example_test.go → example_helloworld_test.go} +0 -0
  76. data/tracks/go/exercises/house/house_test.go +8 -8
  77. data/tracks/go/exercises/meetup/.meta/gen.go +1 -3
  78. data/tracks/go/exercises/meetup/cases_test.go +2 -1
  79. data/tracks/go/exercises/palindrome-products/example.go +1 -1
  80. data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +1 -1
  81. data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +24 -4
  82. data/tracks/go/exercises/rna-transcription/.meta/gen.go +1 -3
  83. data/tracks/go/exercises/rna-transcription/cases_test.go +2 -1
  84. data/tracks/go/exercises/roman-numerals/.meta/gen.go +1 -3
  85. data/tracks/go/exercises/roman-numerals/cases_test.go +2 -1
  86. data/tracks/go/exercises/roman-numerals/example.go +1 -1
  87. data/tracks/go/exercises/transpose/.meta/gen.go +1 -3
  88. data/tracks/go/exercises/transpose/cases_test.go +2 -1
  89. data/tracks/go/exercises/transpose/transpose_test.go +5 -0
  90. data/tracks/go/exercises/word-count/.meta/gen.go +1 -3
  91. data/tracks/go/exercises/word-count/cases_test.go +2 -1
  92. data/tracks/go/gen/gen.go +3 -2
  93. data/tracks/java/config.json +5 -0
  94. data/tracks/java/exercises/saddle-points/build.gradle +17 -0
  95. data/tracks/java/exercises/saddle-points/src/example/java/Matrix.java +44 -0
  96. data/tracks/java/exercises/saddle-points/src/example/java/MatrixCoordinate.java +31 -0
  97. data/tracks/java/exercises/saddle-points/src/main/java/Matrix.java +5 -0
  98. data/tracks/java/exercises/saddle-points/src/main/java/MatrixCoordinate.java +31 -0
  99. data/tracks/java/exercises/saddle-points/src/test/java/MatrixTest.java +82 -0
  100. data/tracks/java/exercises/settings.gradle +1 -0
  101. data/tracks/javascript/.travis.yml +3 -1
  102. data/tracks/javascript/Makefile +2 -8
  103. data/tracks/javascript/SETUP.md +1 -2
  104. data/tracks/javascript/docs/INSTALLATION.md +3 -4
  105. data/tracks/javascript/docs/TESTS.md +14 -26
  106. data/tracks/javascript/exercises/hamming/example.js +7 -11
  107. data/tracks/javascript/exercises/hello-world/HINTS.md +3 -3
  108. data/tracks/javascript/exercises/robot-simulator/example.js +72 -73
  109. data/tracks/perl6/config.json +5 -0
  110. data/tracks/perl6/exercises/clock/Clock.pm6 +4 -0
  111. data/tracks/perl6/exercises/clock/Example.pm6 +12 -0
  112. data/tracks/perl6/exercises/clock/clock.t +534 -0
  113. data/tracks/perl6/exercises/clock/example.yaml +16 -0
  114. data/tracks/perl6/exercises/robot-name/Example.pm +11 -4
  115. data/tracks/php/exercises/hello-world/hello-world.php +1 -1
  116. data/tracks/php/exercises/hello-world/hello-world_test.php +1 -11
  117. data/tracks/php/exercises/robot-name/robot-name_test.php +1 -0
  118. data/tracks/purescript/config.json +7 -0
  119. data/tracks/purescript/exercises/largest-series-product/bower.json +16 -0
  120. data/tracks/purescript/exercises/largest-series-product/examples/src/LargestSeriesProduct.purs +31 -0
  121. data/tracks/purescript/exercises/largest-series-product/src/LargestSeriesProduct.purs +3 -0
  122. data/tracks/purescript/exercises/largest-series-product/test/Main.purs +73 -0
  123. data/tracks/python/exercises/sublist/sublist_test.py +94 -55
  124. data/tracks/ruby/README.md +38 -25
  125. data/tracks/ruby/exercises/hamming/example.tt +6 -4
  126. data/tracks/ruby/exercises/hamming/hamming_test.rb +4 -5
  127. data/tracks/ruby/exercises/linked-list/linked_list_test.rb +16 -0
  128. data/tracks/ruby/exercises/luhn/luhn_test.rb +5 -5
  129. data/tracks/ruby/exercises/ocr-numbers/.meta/.version +1 -0
  130. data/tracks/ruby/exercises/ocr-numbers/example.rb +42 -61
  131. data/tracks/ruby/exercises/ocr-numbers/example.tt +21 -0
  132. data/tracks/ruby/exercises/ocr-numbers/ocr_numbers_test.rb +63 -138
  133. data/tracks/ruby/lib/generator/exercise_cases.rb +43 -0
  134. data/tracks/ruby/lib/generator/underscore.rb +9 -0
  135. data/tracks/ruby/lib/hamming_cases.rb +9 -14
  136. data/tracks/ruby/lib/luhn_cases.rb +2 -18
  137. data/tracks/ruby/lib/ocr_numbers_cases.rb +20 -0
  138. data/tracks/ruby/lib/pig_latin_cases.rb +2 -12
  139. data/tracks/ruby/test/generator/underscore_test.rb +23 -0
  140. data/tracks/scala/config.json +316 -316
  141. metadata +26 -10
  142. data/tracks/cpp/exercises/etl/require_equal_containers.h +0 -88
  143. data/tracks/cpp/exercises/grade-school/require_equal_containers.h +0 -88
  144. data/tracks/cpp/exercises/nucleotide-count/require_equal_containers.h +0 -88
  145. data/tracks/cpp/exercises/series/require_equal_containers.h +0 -88
  146. data/tracks/cpp/exercises/word-count/require_equal_containers.h +0 -88
  147. data/tracks/javascript/exercises/acronym/package.json +0 -12
  148. 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<% test_cases.each do |test_case| %>
7
+ class HammingTest < Minitest::Test
8
+ <% test_cases.each do |test_case| %>
8
9
  def <%= test_case.name %>
9
- <%= test_case.skipped %><% if test_case.raises_error? %>
10
- assert_raises(ArgumentError) { <%= test_case.workload %> }<% else %>
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
- # Test data version:
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
- # In your file, it will look like this:
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 test_A_single_zero_is_invalid
13
+ def test_a_single_zero_is_invalid
14
14
  skip
15
15
  refute Luhn.valid?("0")
16
16
  end
17
17
 
18
- def test_a_simple_valid_SIN_that_remains_valid_if_reversed
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 test_a_simple_valid_SIN_that_becomes_invalid_if_reversed
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 test_a_valid_Canadian_SIN
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 test_invalid_Canadian_SIN
33
+ def test_invalid_canadian_sin
34
34
  skip
35
35
  refute Luhn.valid?("055 444 286")
36
36
  end
@@ -1,80 +1,61 @@
1
- class OCR
2
- attr_reader :text
3
- def initialize(text)
4
- @text = text.split("\n")
5
- end
6
-
7
- def convert
8
- numbers = []
9
- each_row do |row|
10
- numbers << values_in_row(row)
11
- end
12
- format(numbers)
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
- private
16
-
17
- def format(numbers)
18
- numbers.map(&:join).join(',')
20
+ def initialize(text)
21
+ @text = text
19
22
  end
20
23
 
21
- def values_in_row(row)
22
- values = []
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
- def each_row
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
- def each_column
36
- (0...column_count).step(3) do |column|
37
- yield column
38
- end
39
- end
30
+ private
31
+ attr_reader :text
40
32
 
41
- def value_at(row, column)
42
- value(pattern_at(row, column)) || garble
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 pattern_at(row, column)
46
- [
47
- text[row][column, 3],
48
- text[row + 1][column, 3],
49
- text[row + 2][column, 3],
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 column_count
55
- text.first.length
46
+ def numbers
47
+ text.split("\n").each_slice(4)
56
48
  end
57
49
 
58
- def row_count
59
- text.length
50
+ def rows
51
+ @rows ||= text.split("\n")
60
52
  end
61
53
 
62
- def garble
63
- '?'
54
+ def first_row_width
55
+ @first_row_width ||= rows.first.size
64
56
  end
57
+ end
65
58
 
66
- def value(pattern)
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
- class OCRTest < Minitest::Test
7
- def test_recognize_zero
8
- text = <<-NUMBER.chomp
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 test_recognize_one
13
+ def test_recognizes_1
18
14
  skip
19
- text = <<-NUMBER.chomp
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 test_recognize_two
18
+ def test_unreadable_but_correctly_sized_inputs_return_?
29
19
  skip
30
- text = <<-NUMBER.chomp
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 test_recognize_three
23
+ def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error
40
24
  skip
41
- text = <<-NUMBER.chomp
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 test_recognize_four
28
+ def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error
51
29
  skip
52
- text = <<-NUMBER.chomp
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 test_recognize_five
33
+ def test_recognizes_110101100
62
34
  skip
63
- text = <<-NUMBER.chomp
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 test_recognize_six
38
+ def test_garbled_numbers_in_a_string_are_replaced_with_?
73
39
  skip
74
- text = <<-NUMBER.chomp
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 test_recognize_seven
43
+ def test_recognizes_2
84
44
  skip
85
- text = <<-NUMBER.chomp
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 test_recognize_eight
48
+ def test_recognizes_3
95
49
  skip
96
- text = <<-NUMBER.chomp
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 test_recognize_nine
53
+ def test_recognizes_4
106
54
  skip
107
- text = <<-NUMBER.chomp
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 test_identify_garble
58
+ def test_recognizes_5
117
59
  skip
118
- text = <<-NUMBER.chomp
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 test_identify_10
63
+ def test_recognizes_6
128
64
  skip
129
- text = <<-NUMBER.chomp
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 test_identify_110101100
68
+ def test_recognizes_7
139
69
  skip
140
- text = <<-NUMBER.chomp
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 test_identify_with_garble
73
+ def test_recognizes_8
150
74
  skip
151
- text = <<-NUMBER.chomp
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 test_identify_1234567890
78
+ def test_recognizes_9
161
79
  skip
162
- text = <<-NUMBER.chomp
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 test_identify_123_456_789
172
- skip
173
- text = <<-NUMBER.chomp
174
- _ _
175
- | _| _|
176
- ||_ _|
177
-
178
- _ _
179
- |_||_ |_
180
- | _||_|
181
-
182
- _ _ _
183
- ||_||_|
184
- ||_| _|
185
-
186
- NUMBER
187
- assert_equal '123,456,789', OCR.new(text).convert
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