trackler 2.0.8.20 → 2.0.8.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/csharp/.travis.yml +1 -4
  4. data/tracks/csharp/exercises/accumulate/HINTS.md +3 -0
  5. data/tracks/csharp/exercises/allergies/HINTS.md +3 -0
  6. data/tracks/csharp/exercises/alphametics/HINTS.md +5 -0
  7. data/tracks/csharp/exercises/bank-account/HINTS.md +3 -0
  8. data/tracks/csharp/exercises/beer-song/HINTS.md +2 -0
  9. data/tracks/csharp/exercises/clock/HINTS.md +4 -0
  10. data/tracks/csharp/exercises/custom-set/HINTS.md +4 -0
  11. data/tracks/csharp/exercises/difference-of-squares/HINTS.md +4 -0
  12. data/tracks/csharp/exercises/diffie-hellman/HINTS.md +3 -0
  13. data/tracks/csharp/exercises/food-chain/HINTS.md +2 -0
  14. data/tracks/csharp/exercises/forth/HINTS.md +2 -0
  15. data/tracks/csharp/exercises/hangman/HINTS.md +3 -0
  16. data/tracks/csharp/exercises/leap/Example.cs +2 -2
  17. data/tracks/csharp/exercises/leap/Leap.cs +2 -2
  18. data/tracks/csharp/exercises/leap/LeapTest.cs +4 -4
  19. data/tracks/csharp/exercises/sgf-parsing/HINTS.md +2 -0
  20. data/tracks/csharp/exercises/simple-linked-list/HINTS.md +3 -0
  21. data/tracks/csharp/exercises/sublist/HINTS.md +3 -0
  22. data/tracks/csharp/exercises/twelve-days/HINTS.md +2 -0
  23. data/tracks/csharp/exercises/variable-length-quantity/HINTS.md +3 -0
  24. data/tracks/csharp/exercises/wordy/HINTS.md +2 -0
  25. data/tracks/csharp/generators/BooleanTestMethod.cs +36 -0
  26. data/tracks/csharp/generators/Exercises/Exercise.cs +13 -2
  27. data/tracks/csharp/generators/Exercises/LeapExercise.cs +3 -26
  28. data/tracks/csharp/generators/Program.cs +7 -8
  29. data/tracks/csharp/generators/TestClassNameTransformer.cs +9 -0
  30. data/tracks/csharp/generators/TestClassRenderer.cs +1 -1
  31. data/tracks/csharp/generators/TestedClassNameTransformer.cs +11 -0
  32. data/tracks/csharp/generators/TestedMethodNameTransformer.cs +9 -0
  33. data/tracks/csharp/generators/To.cs +3 -0
  34. data/tracks/elixir/config.json +8 -0
  35. data/tracks/elixir/exercises/ocr-numbers/example.exs +47 -0
  36. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers.exs +10 -0
  37. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers_test.exs +254 -0
  38. data/tracks/go/exercises/say/example.go +2 -0
  39. data/tracks/go/exercises/say/say_test.go +8 -0
  40. data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +6 -4
  41. data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +4 -1
  42. data/tracks/go/exercises/sieve/example.go +2 -0
  43. data/tracks/go/exercises/sieve/sieve_test.go +8 -0
  44. data/tracks/go/exercises/simple-cipher/example.go +3 -1
  45. data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +8 -0
  46. data/tracks/go/exercises/sum-of-multiples/example.go +2 -0
  47. data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +8 -0
  48. data/tracks/go/exercises/tournament/tournament_test.go +3 -1
  49. data/tracks/go/exercises/transpose/example.go +2 -0
  50. data/tracks/go/exercises/transpose/transpose_test.go +8 -0
  51. data/tracks/go/exercises/tree-building/tree_test.go +6 -6
  52. data/tracks/go/exercises/triangle/triangle_test.go +6 -6
  53. data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
  54. data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
  55. data/tracks/haskell/exercises/linked-list/src/Deque.hs +4 -4
  56. data/tracks/haskell/exercises/list-ops/src/ListOps.hs +7 -7
  57. data/tracks/haskell/exercises/luhn/src/Luhn.hs +10 -5
  58. data/tracks/haskell/exercises/matrix/src/Matrix.hs +10 -10
  59. data/tracks/haskell/exercises/minesweeper/src/Minesweeper.hs +1 -1
  60. data/tracks/haskell/exercises/nth-prime/src/Prime.hs +2 -1
  61. data/tracks/haskell/exercises/nucleotide-count/src/DNA.hs +1 -1
  62. data/tracks/haskell/exercises/ocr-numbers/src/OCR.hs +1 -1
  63. data/tracks/haskell/exercises/pascals-triangle/src/Triangle.hs +1 -1
  64. data/tracks/haskell/exercises/phone-number/src/Phone.hs +1 -1
  65. data/tracks/haskell/exercises/pig-latin/src/PigLatin.hs +1 -1
  66. data/tracks/haskell/exercises/prime-factors/src/PrimeFactors.hs +1 -1
  67. data/tracks/kotlin/exercises/_template/build.gradle +1 -1
  68. data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
  69. data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
  70. data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
  71. data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
  72. data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
  73. data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
  74. data/tracks/kotlin/exercises/binary/build.gradle +1 -1
  75. data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
  76. data/tracks/kotlin/exercises/bob/build.gradle +1 -1
  77. data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
  78. data/tracks/kotlin/exercises/change/build.gradle +1 -1
  79. data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
  80. data/tracks/kotlin/exercises/etl/build.gradle +1 -1
  81. data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
  82. data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
  83. data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
  84. data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
  85. data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
  86. data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
  87. data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
  88. data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
  89. data/tracks/kotlin/exercises/leap/build.gradle +1 -1
  90. data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
  91. data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
  92. data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
  93. data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
  94. data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
  95. data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
  96. data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
  97. data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
  98. data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
  99. data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
  100. data/tracks/kotlin/exercises/react/build.gradle +1 -1
  101. data/tracks/kotlin/exercises/react/src/test/kotlin/ReactTest.kt +9 -9
  102. data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
  103. data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
  104. data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
  105. data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
  106. data/tracks/kotlin/exercises/series/build.gradle +1 -1
  107. data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
  108. data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
  109. data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
  110. data/tracks/kotlin/exercises/strain/build.gradle +1 -1
  111. data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
  112. data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
  113. data/tracks/perl6/.gitmodules +3 -0
  114. data/tracks/perl6/.travis.yml +1 -0
  115. data/tracks/perl6/config.json +8 -11
  116. data/tracks/perl6/exercises/accumulate/Accumulate.pm6 +1 -0
  117. data/tracks/perl6/exercises/accumulate/Example.pm +8 -8
  118. data/tracks/perl6/exercises/accumulate/accumulate.t +27 -12
  119. data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +1 -0
  120. data/tracks/perl6/exercises/all-your-base/Example.pm +46 -0
  121. data/tracks/perl6/exercises/all-your-base/all-your-base.t +163 -0
  122. data/tracks/perl6/exercises/bob/Bob.pm6 +13 -0
  123. data/tracks/perl6/exercises/bob/Example.pm +9 -9
  124. data/tracks/perl6/exercises/bob/bob.t +201 -34
  125. data/tracks/perl6/exercises/grade-school/Example.pm +13 -12
  126. data/tracks/perl6/exercises/grade-school/GradeSchool.pm6 +4 -0
  127. data/tracks/perl6/exercises/grade-school/grade-school.t +38 -19
  128. data/tracks/perl6/exercises/hello-world/Example.pm +3 -3
  129. data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +2 -2
  130. data/tracks/perl6/exercises/hello-world/hello-world.t +41 -10
  131. data/tracks/perl6/exercises/linked-list/Example.pm6 +33 -34
  132. data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -0
  133. data/tracks/perl6/exercises/linked-list/linked-list.t +32 -22
  134. data/tracks/perl6/exercises/robot-name/Example.pm +8 -15
  135. data/tracks/perl6/exercises/robot-name/Robot.pm6 +1 -0
  136. data/tracks/perl6/exercises/robot-name/robot-name.t +39 -14
  137. data/tracks/php/config.json +5 -0
  138. data/tracks/php/exercises/luhn/example.php +26 -0
  139. data/tracks/php/exercises/luhn/luhn_test.php +95 -0
  140. data/tracks/purescript/README.md +67 -4
  141. data/tracks/python/docs/LEARNING.md +1 -0
  142. data/tracks/python/exercises/acronym/acronym_test.py +5 -1
  143. data/tracks/python/exercises/atbash-cipher/atbash_cipher_test.py +8 -0
  144. data/tracks/python/exercises/hello-world/hello_world_test.py +4 -38
  145. data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +30 -15
  146. metadata +38 -2
@@ -0,0 +1,254 @@
1
+ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
+ Code.load_file("ocr_numbers.exs", __DIR__)
3
+ end
4
+
5
+ ExUnit.start
6
+ ExUnit.configure exclude: :pending, trace: true
7
+
8
+ defmodule OCRNumbersTest do
9
+ use ExUnit.Case
10
+
11
+ # @tag :pending
12
+ test "Recognizes 0" do
13
+ number = OCRNumbers.convert(
14
+ [
15
+ " _ ",
16
+ "| |",
17
+ "|_|",
18
+ " "
19
+ ]
20
+ )
21
+ assert number == {:ok, "0"}
22
+ end
23
+
24
+ @tag :pending
25
+ test "Recognizes 1" do
26
+ number = OCRNumbers.convert(
27
+ [
28
+ " ",
29
+ " |",
30
+ " |",
31
+ " "
32
+ ]
33
+ )
34
+
35
+ assert number == {:ok, "1"}
36
+ end
37
+
38
+ @tag :pending
39
+ test "Unreadable but correctly sized inputs return ?" do
40
+ number = OCRNumbers.convert(
41
+ [
42
+ " ",
43
+ " _",
44
+ " |",
45
+ " "
46
+ ]
47
+ )
48
+
49
+ assert number == {:ok, "?"}
50
+ end
51
+
52
+ @tag :pending
53
+ test "Input with a number of lines that is not a multiple of four raises an error" do
54
+ number = OCRNumbers.convert(
55
+ [
56
+ " _ ",
57
+ "| |",
58
+ " "
59
+ ]
60
+ )
61
+
62
+ assert number == {:error, 'invalid line count'}
63
+ end
64
+
65
+ @tag :pending
66
+ test "Input with a number of columns that is not a multiple of three raises an error" do
67
+ number = OCRNumbers.convert(
68
+ [
69
+ " ",
70
+ " |",
71
+ " |",
72
+ " "
73
+ ]
74
+ )
75
+
76
+ assert number == {:error, 'invalid column count'}
77
+ end
78
+
79
+ @tag :pending
80
+ test "Recognizes 110101100" do
81
+ number = OCRNumbers.convert(
82
+ [
83
+ " _ _ _ _ ",
84
+ " | || | || | | || || |",
85
+ " | ||_| ||_| | ||_||_|",
86
+ " "
87
+ ]
88
+ )
89
+
90
+ assert number == {:ok, "110101100"}
91
+ end
92
+
93
+ @tag :pending
94
+ test "Garbled numbers in a string are replaced with ?" do
95
+ number = OCRNumbers.convert(
96
+ [
97
+ " _ _ _ ",
98
+ " | || | || | || || |",
99
+ " | | _| ||_| | ||_||_|",
100
+ " "
101
+ ]
102
+ )
103
+
104
+ assert number == {:ok, "11?10?1?0"}
105
+ end
106
+
107
+ @tag :pending
108
+ test "Recognizes 2" do
109
+ number = OCRNumbers.convert(
110
+ [
111
+ " _ ",
112
+ " _|",
113
+ "|_ ",
114
+ " "
115
+ ]
116
+ )
117
+
118
+ assert number == {:ok, "2"}
119
+ end
120
+
121
+ @tag :pending
122
+ test "Recognizes 3" do
123
+ number = OCRNumbers.convert(
124
+ [
125
+ " _ ",
126
+ " _|",
127
+ " _|",
128
+ " "
129
+ ]
130
+ )
131
+
132
+ assert number == {:ok, "3"}
133
+ end
134
+
135
+ @tag :pending
136
+ test "Recognizes 4" do
137
+ number = OCRNumbers.convert(
138
+ [
139
+ " ",
140
+ "|_|",
141
+ " |",
142
+ " "
143
+ ]
144
+ )
145
+
146
+ assert number == {:ok, "4"}
147
+ end
148
+
149
+ @tag :pending
150
+ test "Recognizes 5" do
151
+ number = OCRNumbers.convert(
152
+ [
153
+ " _ ",
154
+ "|_ ",
155
+ " _|",
156
+ " "
157
+ ]
158
+ )
159
+
160
+ assert number == {:ok, "5"}
161
+ end
162
+
163
+ @tag :pending
164
+ test "Recognizes 6" do
165
+ number = OCRNumbers.convert(
166
+ [
167
+ " _ ",
168
+ "|_ ",
169
+ "|_|",
170
+ " "
171
+ ]
172
+ )
173
+
174
+ assert number == {:ok, "6"}
175
+ end
176
+
177
+ @tag :pending
178
+ test "Regonizes 7" do
179
+ number = OCRNumbers.convert(
180
+ [
181
+ " _ ",
182
+ " |",
183
+ " |",
184
+ " "
185
+ ]
186
+ )
187
+
188
+ assert number == {:ok, "7"}
189
+ end
190
+
191
+ @tag :pending
192
+ test "Recognizes 8" do
193
+ number = OCRNumbers.convert(
194
+ [
195
+ " _ ",
196
+ "|_|",
197
+ "|_|",
198
+ " "
199
+ ]
200
+ )
201
+
202
+ assert number == {:ok, "8"}
203
+ end
204
+
205
+ @tag :pending
206
+ test "Recognizes 9" do
207
+ number = OCRNumbers.convert(
208
+ [
209
+ " _ ",
210
+ "|_|",
211
+ " _|",
212
+ " "
213
+ ]
214
+ )
215
+
216
+ assert number == {:ok, "9"}
217
+ end
218
+
219
+ @tag :pending
220
+ test "Recognizes string of decimal numbers" do
221
+ number = OCRNumbers.convert(
222
+ [
223
+ " _ _ _ _ _ _ _ _ ",
224
+ " | _| _||_||_ |_ ||_||_|| |",
225
+ " ||_ _| | _||_| ||_| _||_|",
226
+ " "
227
+ ]
228
+ )
229
+
230
+ assert number == {:ok, "1234567890"}
231
+ end
232
+
233
+ @tag :pending
234
+ test "Numbers separated by empty lines are recognized. Lines are joined by commas." do
235
+ number = OCRNumbers.convert(
236
+ [
237
+ " _ _ ",
238
+ " | _| _|",
239
+ " ||_ _|",
240
+ " ",
241
+ " _ _ ",
242
+ "|_||_ |_ ",
243
+ " | _||_|",
244
+ " ",
245
+ " _ _ _ ",
246
+ " ||_||_|",
247
+ " ||_| _|",
248
+ " "
249
+ ]
250
+ )
251
+
252
+ assert number == {:ok, "123,456,789"}
253
+ end
254
+ end
@@ -1,5 +1,7 @@
1
1
  package say
2
2
 
3
+ const testVersion = 1
4
+
3
5
  var small = []string{"zero", "one", "two", "three", "four", "five", "six",
4
6
  "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen",
5
7
  "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}
@@ -7,6 +7,8 @@ import (
7
7
  "testing"
8
8
  )
9
9
 
10
+ const targetTestVersion = 1
11
+
10
12
  var tests = []struct {
11
13
  uint64
12
14
  string
@@ -38,6 +40,12 @@ var tests = []struct {
38
40
  "six hundred fifteen"},
39
41
  }
40
42
 
43
+ func TestTestVersion(t *testing.T) {
44
+ if testVersion != targetTestVersion {
45
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
46
+ }
47
+ }
48
+
41
49
  func TestSay(t *testing.T) {
42
50
  for _, test := range tests {
43
51
  if s := Say(test.uint64); s != test.string {
@@ -18,16 +18,18 @@ var tests = []struct {
18
18
  {"alacrity", 13},
19
19
  }
20
20
 
21
+ func TestTestVersion(t *testing.T) {
22
+ if testVersion != targetTestVersion {
23
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
24
+ }
25
+ }
26
+
21
27
  func TestScore(t *testing.T) {
22
28
  for _, test := range tests {
23
29
  if actual := Score(test.input); actual != test.expected {
24
30
  t.Errorf("Score(%q) expected %d, Actual %d", test.input, test.expected, actual)
25
31
  }
26
32
  }
27
-
28
- if testVersion != targetTestVersion {
29
- t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
30
- }
31
33
  }
32
34
 
33
35
  func BenchmarkScore(b *testing.B) {
@@ -23,10 +23,13 @@ var tests = []struct {
23
23
  {33, []string{"wink"}},
24
24
  }
25
25
 
26
- func TestHandshake(t *testing.T) {
26
+ func TestTestVersion(t *testing.T) {
27
27
  if testVersion != targetTestVersion {
28
28
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
29
29
  }
30
+ }
31
+
32
+ func TestHandshake(t *testing.T) {
30
33
  for _, test := range tests {
31
34
  h := Handshake(test.code)
32
35
  // use len() to allow either nil or empty list, because
@@ -1,5 +1,7 @@
1
1
  package sieve
2
2
 
3
+ const testVersion = 1
4
+
3
5
  func Sieve(limit int) (primes []int) {
4
6
  c := make([]bool, limit)
5
7
  for p := 2; p < limit; {
@@ -5,6 +5,8 @@ import (
5
5
  "testing"
6
6
  )
7
7
 
8
+ const targetTestVersion = 1
9
+
8
10
  var p10 = []int{2, 3, 5, 7}
9
11
  var p1000 = []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
10
12
  59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
@@ -18,6 +20,12 @@ var p1000 = []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
18
20
  797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883,
19
21
  887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997}
20
22
 
23
+ func TestTestVersion(t *testing.T) {
24
+ if testVersion != targetTestVersion {
25
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
26
+ }
27
+ }
28
+
21
29
  func TestSieve(t *testing.T) {
22
30
  p := Sieve(10)
23
31
  if !reflect.DeepEqual(p, p10) {
@@ -2,10 +2,12 @@ package cipher
2
2
 
3
3
  import "strings"
4
4
 
5
- func NewCaesar() Cipher { return NewShift(3) }
5
+ const testVersion = 1
6
6
 
7
7
  type shift int
8
8
 
9
+ func NewCaesar() Cipher { return NewShift(3) }
10
+
9
11
  func NewShift(s int) Cipher {
10
12
  c := shift(s)
11
13
  switch {
@@ -35,6 +35,14 @@ import (
35
35
  "testing"
36
36
  )
37
37
 
38
+ const targetTestVersion = 1
39
+
40
+ func TestTestVersion(t *testing.T) {
41
+ if testVersion != targetTestVersion {
42
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
43
+ }
44
+ }
45
+
38
46
  // type for testing cipher encoding alone, without requiring any text prep.
39
47
  type prepped struct {
40
48
  pt string // prepped text == decoded plain text
@@ -1,5 +1,7 @@
1
1
  package summultiples
2
2
 
3
+ const testVersion = 1
4
+
3
5
  // SumMultiples returns the sum of the multiples of the given divisors
4
6
  // up to, but not including, the given limit.
5
7
  func SumMultiples(limit int, divisors ...int) (sum int) {
@@ -2,6 +2,8 @@ package summultiples
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  var varTests = []struct {
6
8
  divisors []int
7
9
  limit int
@@ -19,6 +21,12 @@ var varTests = []struct {
19
21
  {[]int{}, 10000, 0},
20
22
  }
21
23
 
24
+ func TestTestVersion(t *testing.T) {
25
+ if testVersion != targetTestVersion {
26
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
27
+ }
28
+ }
29
+
22
30
  func TestSumMultiples(t *testing.T) {
23
31
  for _, test := range varTests {
24
32
  s := SumMultiples(test.limit, test.divisors...)
@@ -110,11 +110,13 @@ var errorTestCases = []string{
110
110
  "Devastating Donkeys;Allegoric Alaskians;dra",
111
111
  }
112
112
 
113
- func TestTallyHappy(t *testing.T) {
113
+ func TestTestVersion(t *testing.T) {
114
114
  if testVersion != targetTestVersion {
115
115
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
116
116
  }
117
+ }
117
118
 
119
+ func TestTallyHappy(t *testing.T) {
118
120
  for _, tt := range happyTestCases {
119
121
  reader := strings.NewReader(tt.input)
120
122
  var buffer bytes.Buffer
@@ -1,5 +1,7 @@
1
1
  package transpose
2
2
 
3
+ const testVersion = 1
4
+
3
5
  func Transpose(m []string) []string {
4
6
  max := maxLen(m)
5
7
  t := make([]string, max)
@@ -5,6 +5,14 @@ import (
5
5
  "testing"
6
6
  )
7
7
 
8
+ const targetTestVersion = 1
9
+
10
+ func TestTestVersion(t *testing.T) {
11
+ if testVersion != targetTestVersion {
12
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
13
+ }
14
+ }
15
+
8
16
  func TestTranspose(t *testing.T) {
9
17
  for _, test := range testCases {
10
18
  actual := Transpose(test.input)
@@ -210,6 +210,12 @@ func (n Node) String() string {
210
210
  return fmt.Sprintf("%d:%s", n.ID, n.Children)
211
211
  }
212
212
 
213
+ func TestTestVersion(t *testing.T) {
214
+ if testVersion != targetTestVersion {
215
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
216
+ }
217
+ }
218
+
213
219
  func TestMakeTreeSuccess(t *testing.T) {
214
220
  for _, tt := range successTestCases {
215
221
  actual, err := Build(tt.input)
@@ -235,12 +241,6 @@ func TestMakeTreeFailure(t *testing.T) {
235
241
  }
236
242
  }
237
243
 
238
- func TestTestVersion(t *testing.T) {
239
- if testVersion != targetTestVersion {
240
- t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
241
- }
242
- }
243
-
244
244
  func shuffleRecords(records []Record) []Record {
245
245
  rand := rand.New(rand.NewSource(42))
246
246
  newRecords := make([]Record, len(records))
@@ -53,6 +53,12 @@ func init() {
53
53
  testData = append(testData, nf[1:]...)
54
54
  }
55
55
 
56
+ func TestTestVersion(t *testing.T) {
57
+ if testVersion != targetTestVersion {
58
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
59
+ }
60
+ }
61
+
56
62
  // Test that the kinds are not equal to each other.
57
63
  // If they are equal, then TestKind will return false positives.
58
64
  func TestKindsNotEqual(t *testing.T) {
@@ -86,12 +92,6 @@ func TestKind(t *testing.T) {
86
92
  }
87
93
  }
88
94
 
89
- func TestTestVersion(t *testing.T) {
90
- if testVersion != targetTestVersion {
91
- t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
92
- }
93
- }
94
-
95
95
  func BenchmarkKind(b *testing.B) {
96
96
  for i := 0; i < b.N; i++ {
97
97
  for _, test := range testData {
@@ -1,7 +1,7 @@
1
1
  module Atbash (decode, encode) where
2
2
 
3
3
  decode :: String -> String
4
- decode phrase = error "You need to implement this function."
4
+ decode cipherText = error "You need to implement this function."
5
5
 
6
6
  encode :: String -> String
7
- encode phrase = error "You need to implement this function."
7
+ encode plainText = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module Series (largestProduct) where
2
2
 
3
3
  largestProduct :: Int -> String -> Maybe Integer
4
- largestProduct series digits = error "You need to implement this function."
4
+ largestProduct size digits = error "You need to implement this function."
@@ -6,13 +6,13 @@ mkDeque :: IO (Deque a)
6
6
  mkDeque = error "You need to implement this function."
7
7
 
8
8
  pop :: Deque a -> IO (Maybe a)
9
- pop = error "You need to implement this function."
9
+ pop deque = error "You need to implement this function."
10
10
 
11
11
  push :: Deque a -> a -> IO ()
12
- push = error "You need to implement this function."
12
+ push deque x = error "You need to implement this function."
13
13
 
14
14
  unshift :: Deque a -> a -> IO ()
15
- unshift = error "You need to implement this function."
15
+ unshift deque x = error "You need to implement this function."
16
16
 
17
17
  shift :: Deque a -> IO (Maybe a)
18
- shift = error "You need to implement this function."
18
+ shift deque = error "You need to implement this function."
@@ -13,25 +13,25 @@ import Prelude hiding
13
13
  ( length, reverse, map, filter, foldr, (++), concat )
14
14
 
15
15
  foldl' :: (b -> a -> b) -> b -> [a] -> b
16
- foldl' = error "You need to implement this function."
16
+ foldl' f z xs = error "You need to implement this function."
17
17
 
18
18
  foldr :: (a -> b -> b) -> b -> [a] -> b
19
- foldr = error "You need to implement this function."
19
+ foldr f z xs = error "You need to implement this function."
20
20
 
21
21
  length :: [a] -> Int
22
- length = error "You need to implement this function."
22
+ length xs = error "You need to implement this function."
23
23
 
24
24
  reverse :: [a] -> [a]
25
- reverse = error "You need to implement this function."
25
+ reverse xs = error "You need to implement this function."
26
26
 
27
27
  map :: (a -> b) -> [a] -> [b]
28
- map = error "You need to implement this function."
28
+ map f xs = error "You need to implement this function."
29
29
 
30
30
  filter :: (a -> Bool) -> [a] -> [a]
31
- filter = error "You need to implement this function."
31
+ filter p xs = error "You need to implement this function."
32
32
 
33
33
  (++) :: [a] -> [a] -> [a]
34
34
  xs ++ ys = error "You need to implement this function."
35
35
 
36
36
  concat :: [[a]] -> [a]
37
- concat = error "You need to implement this function."
37
+ concat xss = error "You need to implement this function."
@@ -1,11 +1,16 @@
1
1
  module Luhn (addends, checkDigit, checksum, create, isValid) where
2
2
 
3
- addends = error "You need to implement this function."
3
+ addends :: Integer -> [Integer]
4
+ addends n = error "You need to implement this function."
4
5
 
5
- checkDigit = error "You need to implement this function."
6
+ checkDigit :: Integer -> Integer
7
+ checkDigit n = error "You need to implement this function."
6
8
 
7
- checksum = error "You need to implement this function."
9
+ checksum :: Integer -> Integer
10
+ checksum n = error "You need to implement this function."
8
11
 
9
- create = error "You need to implement this function."
12
+ create :: Integer -> Integer
13
+ create n = error "You need to implement this function."
10
14
 
11
- isValid = error "You need to implement this function."
15
+ isValid :: Integer -> Bool
16
+ isValid n = error "You need to implement this function."
@@ -17,31 +17,31 @@ import Data.Vector (Vector)
17
17
  data Matrix a = Dummy deriving (Eq, Show)
18
18
 
19
19
  cols :: Matrix a -> Int
20
- cols = error "You need to implement this function."
20
+ cols matrix = error "You need to implement this function."
21
21
 
22
22
  column :: Int -> Matrix a -> Vector a
23
- column = error "You need to implement this function."
23
+ column x matrix = error "You need to implement this function."
24
24
 
25
25
  flatten :: Matrix a -> Vector a
26
- flatten = error "You need to implement this function."
26
+ flatten matrix = error "You need to implement this function."
27
27
 
28
28
  fromList :: [[a]] -> Matrix a
29
- fromList = error "You need to implement this function."
29
+ fromList xss = error "You need to implement this function."
30
30
 
31
31
  fromString :: Read a => String -> Matrix a
32
- fromString = error "You need to implement this function."
32
+ fromString xs = error "You need to implement this function."
33
33
 
34
34
  reshape :: (Int, Int) -> Matrix a -> Matrix a
35
- reshape = error "You need to implement this function."
35
+ reshape dimensions matrix = error "You need to implement this function."
36
36
 
37
37
  row :: Int -> Matrix a -> Vector a
38
- row = error "You need to implement this function."
38
+ row x matrix = error "You need to implement this function."
39
39
 
40
40
  rows :: Matrix a -> Int
41
- rows = error "You need to implement this function."
41
+ rows matrix = error "You need to implement this function."
42
42
 
43
43
  shape :: Matrix a -> (Int, Int)
44
- shape = error "You need to implement this function."
44
+ shape matrix = error "You need to implement this function."
45
45
 
46
46
  transpose :: Matrix a -> Matrix a
47
- transpose = error "You need to implement this function."
47
+ transpose matrix = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module Minesweeper (annotate) where
2
2
 
3
3
  annotate :: [String] -> [String]
4
- annotate = error "You need to implement this function."
4
+ annotate board = error "You need to implement this function."
@@ -1,3 +1,4 @@
1
1
  module Prime (nth) where
2
2
 
3
- nth = error "You need to implement this function."
3
+ nth :: Int -> Maybe Integer
4
+ nth n = error "You need to implement this function."
@@ -3,4 +3,4 @@ module DNA (nucleotideCounts) where
3
3
  import Data.Map (Map)
4
4
 
5
5
  nucleotideCounts :: String -> Either String (Map Char Int)
6
- nucleotideCounts = error "You need to implement this function."
6
+ nucleotideCounts xs = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module OCR (convert) where
2
2
 
3
3
  convert :: String -> String
4
- convert = error "You need to implement this function."
4
+ convert xs = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module Triangle (rows) where
2
2
 
3
3
  rows :: Int -> [[Integer]]
4
- rows = error "You need to implement this function."
4
+ rows x = error "You need to implement this function."