trackler 2.0.6.41 → 2.0.6.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +15 -3
  3. data/common/README.md +7 -2
  4. data/common/exercises/binary/.deprecated +3 -0
  5. data/common/exercises/counter/.deprecated +2 -0
  6. data/common/exercises/hexadecimal/.deprecated +3 -0
  7. data/common/exercises/luhn/description.md +9 -31
  8. data/common/exercises/octal/.deprecated +3 -0
  9. data/common/exercises/point-mutations/.deprecated +2 -0
  10. data/common/exercises/trinary/.deprecated +3 -0
  11. data/lib/trackler/version.rb +1 -1
  12. data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +2 -3
  13. data/tracks/ceylon/config.json +8 -0
  14. data/tracks/ceylon/docs/ABOUT.md +15 -0
  15. data/tracks/ceylon/docs/INSTALLATION.md +9 -0
  16. data/tracks/ceylon/docs/LEARNING.md +7 -0
  17. data/tracks/ceylon/docs/TESTS.md +11 -0
  18. data/tracks/ceylon/exercises/TRACK_HINTS.md +11 -0
  19. data/tracks/ceylon/exercises/hamming/example/Hamming.ceylon +8 -0
  20. data/tracks/ceylon/exercises/hamming/source/hamming/Hamming.ceylon +5 -0
  21. data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +30 -0
  22. data/tracks/ceylon/exercises/hamming/source/hamming/module.ceylon +3 -0
  23. data/tracks/erlang/_test/check-exercises.escript +2 -2
  24. data/tracks/erlang/exercises/{circular-buffer/rebar.conf → accumulate/rebar.config} +1 -1
  25. data/tracks/erlang/exercises/allergies/{rebar.conf → rebar.config} +1 -1
  26. data/tracks/erlang/exercises/{accumulate/rebar.conf → anagram/rebar.config} +3 -1
  27. data/tracks/erlang/exercises/{bob/rebar.conf → atbash-cipher/rebar.config} +1 -1
  28. data/tracks/erlang/exercises/{binary/rebar.conf → bank-account/rebar.config} +1 -1
  29. data/tracks/erlang/exercises/beer-song/rebar.conf +1 -1
  30. data/tracks/erlang/exercises/binary/rebar.config +30 -0
  31. data/tracks/erlang/exercises/bob/rebar.config +30 -0
  32. data/tracks/erlang/exercises/circular-buffer/rebar.config +30 -0
  33. data/tracks/erlang/exercises/clock/rebar.config +30 -0
  34. data/tracks/erlang/exercises/difference-of-squares/rebar.config +30 -0
  35. data/tracks/erlang/exercises/etl/rebar.config +30 -0
  36. data/tracks/erlang/exercises/gigasecond/rebar.config +30 -0
  37. data/tracks/erlang/exercises/grade-school/rebar.config +30 -0
  38. data/tracks/erlang/exercises/grains/rebar.config +30 -0
  39. data/tracks/erlang/exercises/hamming/rebar.config +30 -0
  40. data/tracks/erlang/exercises/hello-world/rebar.config +30 -0
  41. data/tracks/erlang/exercises/largest-series-product/rebar.config +30 -0
  42. data/tracks/erlang/exercises/leap/rebar.config +30 -0
  43. data/tracks/erlang/exercises/luhn/rebar.config +30 -0
  44. data/tracks/erlang/exercises/meetup/rebar.config +30 -0
  45. data/tracks/erlang/exercises/nucleotide-count/rebar.config +30 -0
  46. data/tracks/erlang/exercises/parallel-letter-frequency/rebar.config +30 -0
  47. data/tracks/erlang/exercises/phone-number/rebar.config +30 -0
  48. data/tracks/erlang/exercises/rna-transcription/rebar.config +30 -0
  49. data/tracks/erlang/exercises/robot-simulator/HINTS.md +9 -0
  50. data/tracks/erlang/exercises/robot-simulator/rebar.config +30 -0
  51. data/tracks/erlang/exercises/roman-numerals/rebar.config +30 -0
  52. data/tracks/erlang/exercises/scrabble-score/rebar.config +30 -0
  53. data/tracks/erlang/exercises/series/rebar.config +30 -0
  54. data/tracks/erlang/exercises/space-age/rebar.config +30 -0
  55. data/tracks/erlang/exercises/strain/rebar.config +30 -0
  56. data/tracks/erlang/exercises/sum-of-multiples/rebar.config +30 -0
  57. data/tracks/erlang/exercises/triangle/rebar.config +30 -0
  58. data/tracks/erlang/exercises/trinary/rebar.config +30 -0
  59. data/tracks/erlang/exercises/word-count/rebar.config +30 -0
  60. data/tracks/erlang/exercises/zipper/rebar.config +30 -0
  61. data/tracks/go/README.md +2 -1
  62. data/tracks/go/exercises/diamond/diamond_test.go +8 -8
  63. data/tracks/go/exercises/difference-of-squares/difference_of_squares_test.go +8 -0
  64. data/tracks/go/exercises/difference-of-squares/example.go +2 -0
  65. data/tracks/go/exercises/diffie-hellman/diffie_hellman_test.go +8 -0
  66. data/tracks/go/exercises/diffie-hellman/example.go +2 -0
  67. data/tracks/go/exercises/error-handling/error_handling_test.go +8 -8
  68. data/tracks/go/exercises/etl/etl_test.go +8 -0
  69. data/tracks/go/exercises/etl/example.go +2 -0
  70. data/tracks/go/exercises/food-chain/food_chain_test.go +6 -6
  71. data/tracks/go/exercises/hello-world/hello_world.go +2 -2
  72. data/tracks/go/exercises/hexadecimal/hexadecimal_test.go +6 -6
  73. data/tracks/go/exercises/house/house_test.go +6 -6
  74. data/tracks/go/exercises/isogram/isogram_test.go +8 -8
  75. data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +6 -6
  76. data/tracks/go/exercises/leap/leap_test.go +4 -1
  77. data/tracks/go/exercises/ledger/ledger_test.go +4 -1
  78. data/tracks/go/exercises/matrix/matrix_test.go +6 -6
  79. data/tracks/go/exercises/meetup/meetup_test.go +4 -1
  80. data/tracks/go/exercises/nth-prime/example.go +2 -0
  81. data/tracks/go/exercises/nth-prime/nth_prime_test.go +8 -0
  82. data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +8 -8
  83. data/tracks/idris/.gitignore +2 -0
  84. data/tracks/idris/_src/Makefile.template +23 -0
  85. data/tracks/idris/config.json +9 -2
  86. data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +5 -0
  87. data/tracks/idris/exercises/hello-world/Makefile +23 -0
  88. data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +25 -0
  89. data/tracks/idris/exercises/hello-world/src/example.idr +5 -0
  90. data/tracks/java/.travis.yml +5 -0
  91. data/tracks/java/bin/build-jq.sh +11 -0
  92. data/tracks/java/exercises/allergies/src/test/java/AllergiesTest.java +14 -13
  93. data/tracks/java/exercises/hamming/src/test/java/HammingTest.java +2 -2
  94. data/tracks/java/exercises/nth-prime/src/test/java/PrimeTest.java +8 -1
  95. data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideTest.java +12 -6
  96. data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java +8 -2
  97. data/tracks/java/exercises/series/src/test/java/SeriesTest.java +10 -4
  98. data/tracks/java/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java +7 -2
  99. data/tracks/java/exercises/triangle/src/test/java/TriangleTest.java +29 -20
  100. data/tracks/kotlin/config.json +5 -0
  101. data/tracks/kotlin/exercises/build.gradle +17 -0
  102. data/tracks/kotlin/exercises/perfect-numbers/build.gradle +28 -0
  103. data/tracks/kotlin/exercises/perfect-numbers/src/example/kotlin/NaturalNumber.kt +17 -0
  104. data/tracks/kotlin/exercises/perfect-numbers/src/main/kotlin/NaturalNumber.kt +8 -0
  105. data/tracks/kotlin/exercises/perfect-numbers/src/test/kotlin/PerfectNumbersTest.kt +67 -0
  106. data/tracks/kotlin/exercises/settings.gradle +1 -0
  107. data/tracks/lua/exercises/hamming/example.lua +1 -0
  108. data/tracks/lua/exercises/hamming/hamming_spec.lua +19 -11
  109. data/tracks/ocaml/config.json +5 -0
  110. data/tracks/ocaml/exercises/beer-song/beer_song.mli +1 -1
  111. data/tracks/ocaml/exercises/beer-song/example.ml +3 -3
  112. data/tracks/ocaml/exercises/beer-song/test.ml +45 -22
  113. data/tracks/ocaml/exercises/run-length-encoding/.merlin +5 -0
  114. data/tracks/ocaml/exercises/run-length-encoding/Makefile +11 -0
  115. data/tracks/ocaml/exercises/run-length-encoding/example.ml +37 -0
  116. data/tracks/ocaml/exercises/run-length-encoding/run_length_encoding.mli +3 -0
  117. data/tracks/ocaml/exercises/run-length-encoding/test.ml +38 -0
  118. data/tracks/ocaml/tools/test-generator/src/template.ml +0 -2
  119. data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +19 -0
  120. data/tracks/ocaml/tools/test-generator/templates/run-length-encoding/template.ml +19 -0
  121. data/tracks/php/config.json +17 -0
  122. data/tracks/php/exercises/queen-attack/example.php +86 -0
  123. data/tracks/php/exercises/queen-attack/queen-attack_test.php +125 -0
  124. data/tracks/php/exercises/scrabble-score/example.php +27 -0
  125. data/tracks/php/exercises/scrabble-score/scrabble-score_test.php +120 -0
  126. data/tracks/r/exercises/luhn/example.R +20 -32
  127. data/tracks/r/exercises/luhn/luhn.R +1 -22
  128. data/tracks/r/exercises/luhn/test_luhn.R +43 -55
  129. metadata +67 -37
  130. data/tracks/erlang/exercises/anagram/rebar.conf +0 -32
  131. data/tracks/erlang/exercises/atbash-cipher/rebar.conf +0 -30
  132. data/tracks/erlang/exercises/bank-account/rebar.conf +0 -30
  133. data/tracks/erlang/exercises/clock/rebar.conf +0 -30
  134. data/tracks/erlang/exercises/difference-of-squares/rebar.conf +0 -30
  135. data/tracks/erlang/exercises/etl/rebar.conf +0 -30
  136. data/tracks/erlang/exercises/gigasecond/rebar.conf +0 -30
  137. data/tracks/erlang/exercises/grade-school/rebar.conf +0 -30
  138. data/tracks/erlang/exercises/grains/rebar.conf +0 -30
  139. data/tracks/erlang/exercises/hamming/rebar.conf +0 -30
  140. data/tracks/erlang/exercises/hello-world/rebar.conf +0 -30
  141. data/tracks/erlang/exercises/largest-series-product/rebar.conf +0 -30
  142. data/tracks/erlang/exercises/leap/rebar.conf +0 -30
  143. data/tracks/erlang/exercises/luhn/rebar.conf +0 -30
  144. data/tracks/erlang/exercises/meetup/rebar.conf +0 -30
  145. data/tracks/erlang/exercises/nucleotide-count/rebar.conf +0 -30
  146. data/tracks/erlang/exercises/parallel-letter-frequency/rebar.conf +0 -30
  147. data/tracks/erlang/exercises/phone-number/rebar.conf +0 -30
  148. data/tracks/erlang/exercises/rna-transcription/rebar.conf +0 -30
  149. data/tracks/erlang/exercises/robot-simulator/rebar.conf +0 -30
  150. data/tracks/erlang/exercises/roman-numerals/rebar.conf +0 -30
  151. data/tracks/erlang/exercises/scrabble-score/rebar.conf +0 -30
  152. data/tracks/erlang/exercises/series/rebar.conf +0 -30
  153. data/tracks/erlang/exercises/space-age/rebar.conf +0 -30
  154. data/tracks/erlang/exercises/strain/rebar.conf +0 -30
  155. data/tracks/erlang/exercises/sum-of-multiples/rebar.conf +0 -30
  156. data/tracks/erlang/exercises/triangle/rebar.conf +0 -30
  157. data/tracks/erlang/exercises/trinary/rebar.conf +0 -30
  158. data/tracks/erlang/exercises/word-count/rebar.conf +0 -30
  159. data/tracks/erlang/exercises/zipper/rebar.conf +0 -30
@@ -0,0 +1,30 @@
1
+ %% Erlang compiler options
2
+ {erl_opts, [debug_info]}.
3
+
4
+ {deps, []}.
5
+
6
+ {dialyzer, [
7
+ {warnings, [underspecs, no_return]},
8
+ {get_warnings, true},
9
+ {plt_apps, top_level_deps}, % top_level_deps | all_deps
10
+ {plt_extra_apps, []},
11
+ {plt_location, local}, % local | "/my/file/name"
12
+ {plt_prefix, "rebar3"},
13
+ {base_plt_apps, [stdlib, kernel, crypto]},
14
+ {base_plt_location, global}, % global | "/my/file/name"
15
+ {base_plt_prefix, "rebar3"}
16
+ ]}.
17
+
18
+ %% eunit:test(Tests)
19
+ {eunit_tests, []}.
20
+ %% Options for eunit:test(Tests, Opts)
21
+ {eunit_opts, [verbose]}.
22
+
23
+ %% == xref ==
24
+
25
+ {xref_warnings, true}.
26
+
27
+ %% xref checks to run
28
+ {xref_checks, [undefined_function_calls, undefined_functions,
29
+ locals_not_used, exports_not_used,
30
+ deprecated_function_calls, deprecated_functions]}.
@@ -0,0 +1,30 @@
1
+ %% Erlang compiler options
2
+ {erl_opts, [debug_info]}.
3
+
4
+ {deps, []}.
5
+
6
+ {dialyzer, [
7
+ {warnings, [underspecs, no_return]},
8
+ {get_warnings, true},
9
+ {plt_apps, top_level_deps}, % top_level_deps | all_deps
10
+ {plt_extra_apps, []},
11
+ {plt_location, local}, % local | "/my/file/name"
12
+ {plt_prefix, "rebar3"},
13
+ {base_plt_apps, [stdlib, kernel, crypto]},
14
+ {base_plt_location, global}, % global | "/my/file/name"
15
+ {base_plt_prefix, "rebar3"}
16
+ ]}.
17
+
18
+ %% eunit:test(Tests)
19
+ {eunit_tests, []}.
20
+ %% Options for eunit:test(Tests, Opts)
21
+ {eunit_opts, [verbose]}.
22
+
23
+ %% == xref ==
24
+
25
+ {xref_warnings, true}.
26
+
27
+ %% xref checks to run
28
+ {xref_checks, [undefined_function_calls, undefined_functions,
29
+ locals_not_used, exports_not_used,
30
+ deprecated_function_calls, deprecated_functions]}.
data/tracks/go/README.md CHANGED
@@ -31,12 +31,13 @@ This is because this repo only imports from the standard library and isn't expec
31
31
  Please be familiar with the [contributing guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md)
32
32
  in the x-common repository. This describes how all the language tracks are put together, as well as details about
33
33
  the common metadata, and high-level information about contributing to existing problems and adding new problems.
34
+ In particular, please read the [Pull Request Guidelines](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#pull-request-guidelines) before opening a pull request.
34
35
 
35
36
  ## Problem Versioning
36
37
 
37
38
  Each problem defines a `const targetTestVersion` in the test program, and validates that the solution has defined a matching value `testVersion`. Any xgo developer that changes the test program or test data increments `targetTestVersion`.
38
39
 
39
- The benefit of all this is that nipickers can see which test version a posted solution was written for and be spared confusion over why an old posted solution might not pass current tests.
40
+ The benefit of all this is that reviewers can see which test version a posted solution was written for and be spared confusion over why an old posted solution might not pass current tests.
40
41
 
41
42
  Notice that neither the `testVersion` nor the `targetTestVersion` is exported. This is so that golint will not complain about a missing comment. In general, adding tests for unexported names is considered an anti-pattern, but in this case the trade-off seems acceptable.
42
43
 
@@ -9,6 +9,8 @@ import (
9
9
  "time"
10
10
  )
11
11
 
12
+ const targetTestVersion = 1
13
+
12
14
  var config = &quick.Config{Rand: rand.New(rand.NewSource(time.Now().UnixNano()))}
13
15
 
14
16
  type correctChar byte
@@ -38,6 +40,12 @@ func checkCorrect(requirement func(byte, []string) bool, keepSeparator bool, t *
38
40
  }
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 TestFirstRowContainsOneA(t *testing.T) {
42
50
  requirement := func(char byte, rows []string) bool {
43
51
  return len(rows) > 0 && strings.Count(rows[0], "A") == 1
@@ -217,11 +225,3 @@ func TestCharOutOfRangeShouldGiveError(t *testing.T) {
217
225
  t.Error(err)
218
226
  }
219
227
  }
220
-
221
- const targetTestVersion = 1
222
-
223
- func TestTestVersion(t *testing.T) {
224
- if testVersion != targetTestVersion {
225
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
226
- }
227
- }
@@ -2,12 +2,20 @@ package diffsquares
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  var tests = []struct{ n, sqOfSums, sumOfSq int }{
6
8
  {5, 225, 55},
7
9
  {10, 3025, 385},
8
10
  {100, 25502500, 338350},
9
11
  }
10
12
 
13
+ func TestTestVersion(t *testing.T) {
14
+ if testVersion != targetTestVersion {
15
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
16
+ }
17
+ }
18
+
11
19
  func TestSquareOfSums(t *testing.T) {
12
20
  for _, test := range tests {
13
21
  if s := SquareOfSums(test.n); s != test.sqOfSums {
@@ -1,5 +1,7 @@
1
1
  package diffsquares
2
2
 
3
+ const testVersion = 1
4
+
3
5
  func SquareOfSums(n int) int {
4
6
  s := 0
5
7
  for i := 0; i <= n; i++ {
@@ -14,6 +14,8 @@ import (
14
14
  "testing"
15
15
  )
16
16
 
17
+ const targetTestVersion = 1
18
+
17
19
  type testCase struct {
18
20
  g int64 // prime, generator
19
21
  p *big.Int // prime, modulus
@@ -78,6 +80,12 @@ var tests = []testCase{
78
80
 
79
81
  var _one = big.NewInt(1)
80
82
 
83
+ func TestTestVersion(t *testing.T) {
84
+ if testVersion != targetTestVersion {
85
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
86
+ }
87
+ }
88
+
81
89
  // test that PrivateKey returns numbers in range, returns different numbers.
82
90
  func TestPrivateKey(t *testing.T) {
83
91
  priv := func(p *big.Int) *big.Int {
@@ -6,6 +6,8 @@ import (
6
6
  "time"
7
7
  )
8
8
 
9
+ const testVersion = 1
10
+
9
11
  var r = rand.New(rand.NewSource(time.Now().Unix()))
10
12
  var two = big.NewInt(2)
11
13
 
@@ -27,6 +27,14 @@ func (mr mockResource) Close() error { return mr.close() }
27
27
  func (mr mockResource) Frob(input string) { mr.frob(input) }
28
28
  func (mr mockResource) Defrob(tag string) { mr.defrob(tag) }
29
29
 
30
+ // If this test fails and you've properly defined testVersion the requirements
31
+ // of the tests have changed since you wrote your submission.
32
+ func TestTestVersion(t *testing.T) {
33
+ if testVersion != targetTestVersion {
34
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
35
+ }
36
+ }
37
+
30
38
  // Use should not return an error on the "happy" path.
31
39
  func TestNoErrors(t *testing.T) {
32
40
  var frobInput string
@@ -155,11 +163,3 @@ func TestCallCloseNonOnFrobError(t *testing.T) {
155
163
  t.Fatalf("Close was not called")
156
164
  }
157
165
  }
158
-
159
- // If this test fails and you've properly defined testVersion the requirements
160
- // of the tests have changed since you wrote your submission.
161
- func TestTestVersion(t *testing.T) {
162
- if testVersion != targetTestVersion {
163
- t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
164
- }
165
- }
@@ -2,6 +2,8 @@ package etl
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  type given map[int][]string
6
8
  type expectation map[string]int
7
9
 
@@ -67,6 +69,12 @@ func equal(actual map[string]int, expectation map[string]int) bool {
67
69
  return true
68
70
  }
69
71
 
72
+ func TestTestVersion(t *testing.T) {
73
+ if testVersion != targetTestVersion {
74
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
75
+ }
76
+ }
77
+
70
78
  func TestTransform(t *testing.T) {
71
79
  for _, tt := range transformTests {
72
80
  actual := Transform(map[int][]string(tt.input))
@@ -2,6 +2,8 @@ package etl
2
2
 
3
3
  import "strings"
4
4
 
5
+ const testVersion = 1
6
+
5
7
  type legacy map[int][]string
6
8
 
7
9
  func Transform(in legacy) (out map[string]int) {
@@ -8,12 +8,6 @@ import (
8
8
 
9
9
  const targetTestVersion = 3
10
10
 
11
- func TestTestVersion(t *testing.T) {
12
- if testVersion != targetTestVersion {
13
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
14
- }
15
- }
16
-
17
11
  var ref = []string{``,
18
12
 
19
13
  `I know an old lady who swallowed a fly.
@@ -92,6 +86,12 @@ func diff(got, want string) string {
92
86
  }
93
87
  }
94
88
 
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 TestVerse(t *testing.T) {
96
96
  for v := 1; v <= 8; v++ {
97
97
  if ret := Verse(v); ret != ref[v] {
@@ -7,7 +7,7 @@ package greeting
7
7
 
8
8
  // testVersion identifies the version of the test program that you are
9
9
  // writing your code to. If the test program changes in the future --
10
- // after you have posted this code to the Exercism site -- nitpickers
10
+ // after you have posted this code to the Exercism site -- reviewers
11
11
  // will see that your code can't necessarily be expected to pass the
12
12
  // current test suite because it was written to an earlier test version.
13
13
  const testVersion = 3
@@ -18,6 +18,6 @@ func HelloWorld(string) string {
18
18
 
19
19
  // When you have a working solution, REMOVE ALL THE STOCK COMMENTS.
20
20
  // They're here to help you get started but they only clutter a finished solution.
21
- // If you leave them in, nitpickers will protest!
21
+ // If you leave them in, reviewers will protest!
22
22
  return ""
23
23
  }
@@ -17,12 +17,6 @@ import (
17
17
 
18
18
  const targetTestVersion = 1
19
19
 
20
- func TestTestVersion(t *testing.T) {
21
- if testVersion != targetTestVersion {
22
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
23
- }
24
- }
25
-
26
20
  var testCases = []struct {
27
21
  in string
28
22
  out int64
@@ -41,6 +35,12 @@ var testCases = []struct {
41
35
  {"9223372036854775809", 0, "range"},
42
36
  }
43
37
 
38
+ func TestTestVersion(t *testing.T) {
39
+ if testVersion != targetTestVersion {
40
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
41
+ }
42
+ }
43
+
44
44
  func TestParseHex(t *testing.T) {
45
45
  for _, test := range testCases {
46
46
  out, err := ParseHex(test.in)
@@ -112,6 +112,12 @@ that lay in the house that Jack built.`
112
112
  verses = strings.Split(song, "\n\n")
113
113
  )
114
114
 
115
+ func TestTestVersion(t *testing.T) {
116
+ if testVersion != targetTestVersion {
117
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
118
+ }
119
+ }
120
+
115
121
  func TestVerse(t *testing.T) {
116
122
  for v := 0; v < len(verses); v++ {
117
123
  if ret := Verse(v + 1); ret != verses[v] {
@@ -146,9 +152,3 @@ func TestSong(t *testing.T) {
146
152
  }
147
153
  t.Fatalf("Song() line %d =\n%q\n want \n%q", i+1, g, w)
148
154
  }
149
-
150
- func TestTestVersion(t *testing.T) {
151
- if testVersion != targetTestVersion {
152
- t.Errorf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
153
- }
154
- }
@@ -2,6 +2,8 @@ package isogram
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  var testCases = []struct {
6
8
  word string
7
9
  expected bool
@@ -18,6 +20,12 @@ var testCases = []struct {
18
20
  {"éléphant", false},
19
21
  }
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 TestIsIsogram(t *testing.T) {
22
30
  for _, c := range testCases {
23
31
  if IsIsogram(c.word) != c.expected {
@@ -40,11 +48,3 @@ func BenchmarkIsIsogram(b *testing.B) {
40
48
  b.StopTimer()
41
49
  }
42
50
  }
43
-
44
- const targetTestVersion = 1
45
-
46
- func TestTestVersion(t *testing.T) {
47
- if testVersion != targetTestVersion {
48
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
49
- }
50
- }
@@ -26,12 +26,6 @@ import (
26
26
 
27
27
  const targetTestVersion = 1
28
28
 
29
- func TestTestVersion(t *testing.T) {
30
- if testVersion != targetTestVersion {
31
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
32
- }
33
- }
34
-
35
29
  type lookup struct {
36
30
  child string
37
31
  plants []string
@@ -125,6 +119,12 @@ RVGCCGCV`, append([]string{}, test6names...), true, []lookup{
125
119
  }}
126
120
  )
127
121
 
122
+ func TestTestVersion(t *testing.T) {
123
+ if testVersion != targetTestVersion {
124
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
125
+ }
126
+ }
127
+
128
128
  func TestGarden(t *testing.T) {
129
129
  for _, test := range tests {
130
130
  g, err := NewGarden(test.diagram, test.children)
@@ -9,10 +9,13 @@ import "testing"
9
9
 
10
10
  const targetTestVersion = 3
11
11
 
12
- func TestLeapYears(t *testing.T) {
12
+ func TestTestVersion(t *testing.T) {
13
13
  if testVersion != targetTestVersion {
14
14
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
15
15
  }
16
+ }
17
+
18
+ func TestLeapYears(t *testing.T) {
16
19
  for _, test := range testCases {
17
20
  observed := IsLeapYear(test.year)
18
21
  if observed != test.expected {
@@ -250,10 +250,13 @@ var failureTestCases = []struct {
250
250
  },
251
251
  }
252
252
 
253
- func TestFormatLedgerSuccess(t *testing.T) {
253
+ func TestTestVersion(t *testing.T) {
254
254
  if testVersion != targetTestVersion {
255
255
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
256
256
  }
257
+ }
258
+
259
+ func TestFormatLedgerSuccess(t *testing.T) {
257
260
  for _, tt := range successTestCases {
258
261
  actual, err := FormatLedger(tt.currency, tt.locale, tt.entries)
259
262
  // We don't expect errors for any of the test cases
@@ -142,6 +142,12 @@ var tests = []struct {
142
142
  // {"", // valid?, 0 rows, 0 columns
143
143
  }
144
144
 
145
+ func TestTestVersion(t *testing.T) {
146
+ if testVersion != targetTestVersion {
147
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
148
+ }
149
+ }
150
+
145
151
  func TestNew(t *testing.T) {
146
152
  for _, test := range tests {
147
153
  m, err := New(test.in)
@@ -266,9 +272,3 @@ func TestSet(t *testing.T) {
266
272
  }
267
273
  }
268
274
  }
269
-
270
- func TestTestVersion(t *testing.T) {
271
- if testVersion != targetTestVersion {
272
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
273
- }
274
- }
@@ -25,10 +25,13 @@ var weekName = map[WeekSchedule]string{
25
25
  Last: "last",
26
26
  }
27
27
 
28
- func TestDay(t *testing.T) {
28
+ func TestTestVersion(t *testing.T) {
29
29
  if testVersion != targetTestVersion {
30
30
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
31
31
  }
32
+ }
33
+
34
+ func TestDay(t *testing.T) {
32
35
  for _, test := range testCases {
33
36
  res := Day(test.week, test.weekday, test.month, test.year)
34
37
  if res != test.expDay {
@@ -1,5 +1,7 @@
1
1
  package prime
2
2
 
3
+ const testVersion = 1
4
+
3
5
  func Nth(n int) (p int, ok bool) {
4
6
  switch {
5
7
  case n < 1:
@@ -2,6 +2,8 @@ package prime
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  var tests = []struct {
6
8
  n int
7
9
  p int
@@ -17,6 +19,12 @@ var tests = []struct {
17
19
  {0, 0, false},
18
20
  }
19
21
 
22
+ func TestTestVersion(t *testing.T) {
23
+ if testVersion != targetTestVersion {
24
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
25
+ }
26
+ }
27
+
20
28
  func TestNth(t *testing.T) {
21
29
  for _, test := range tests {
22
30
  switch p, ok := Nth(test.n); {
@@ -5,6 +5,8 @@ import (
5
5
  "testing"
6
6
  )
7
7
 
8
+ const targetTestVersion = 2
9
+
8
10
  var tallyTests = []struct {
9
11
  strand DNA
10
12
  nucleotide byte
@@ -16,6 +18,12 @@ var tallyTests = []struct {
16
18
  {"GGGGGTAACCCGG", 'T', 1},
17
19
  }
18
20
 
21
+ func TestTestVersion(t *testing.T) {
22
+ if testVersion != targetTestVersion {
23
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
24
+ }
25
+ }
26
+
19
27
  func TestNucleotideCounts(t *testing.T) {
20
28
  for _, tt := range tallyTests {
21
29
  if count, err := tt.strand.Count(tt.nucleotide); err != nil {
@@ -101,11 +109,3 @@ func BenchmarkSequenceHistograms(b *testing.B) {
101
109
  }
102
110
  }
103
111
  }
104
-
105
- const targetTestVersion = 2
106
-
107
- func TestTestVersion(t *testing.T) {
108
- if testVersion != targetTestVersion {
109
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
110
- }
111
- }
@@ -2,3 +2,5 @@
2
2
  .DS_Store
3
3
  bin/configlet
4
4
  bin/configlet.exe
5
+ *.ibc
6
+ *.o
@@ -0,0 +1,23 @@
1
+ idris ?= idris
2
+ pkg := {{exercise}}
3
+
4
+ .PHONY: build clean clobber install rebuild test
5
+
6
+ all: build
7
+
8
+ build:
9
+ @ ${idris} --build ${pkg}.ipkg
10
+
11
+ clean:
12
+ @ ${idris} --clean ${pkg}.ipkg
13
+
14
+ clobber: clean
15
+ @ find . -name '*.ibc' -delete
16
+
17
+ install:
18
+ @ ${idris} --install ${pkg}.ipkg
19
+
20
+ rebuild: clean build
21
+
22
+ test:
23
+ @ ${idris} --testpkg ${pkg}.ipkg
@@ -3,11 +3,11 @@
3
3
  "language": "Idris",
4
4
  "repository": "https://github.com/exercism/xidris",
5
5
  "active": false,
6
- "test_pattern": "TODO",
7
6
  "deprecated": [
8
7
 
9
8
  ],
10
9
  "ignored": [
10
+ "_src",
11
11
  "bin",
12
12
  "docs"
13
13
  ],
@@ -15,6 +15,13 @@
15
15
 
16
16
  ],
17
17
  "exercises": [
18
-
18
+ {
19
+ "slug": "hello-world",
20
+ "difficulty": 1,
21
+ "topics": [
22
+ "optional values",
23
+ "text formatting"
24
+ ]
25
+ }
19
26
  ]
20
27
  }
@@ -0,0 +1,5 @@
1
+ package helloworld
2
+
3
+ sourcedir = src
4
+ modules = HelloWorld, Test.HelloWorld
5
+ tests = Test.HelloWorld.runTests
@@ -0,0 +1,23 @@
1
+ idris ?= idris
2
+ pkg := HelloWorld
3
+
4
+ .PHONY: build clean clobber install rebuild test
5
+
6
+ all: build
7
+
8
+ build:
9
+ @ ${idris} --build ${pkg}.ipkg
10
+
11
+ clean:
12
+ @ ${idris} --clean ${pkg}.ipkg
13
+
14
+ clobber: clean
15
+ @ find . -name '*.ibc' -delete
16
+
17
+ install:
18
+ @ ${idris} --install ${pkg}.ipkg
19
+
20
+ rebuild: clean build
21
+
22
+ test:
23
+ @ ${idris} --testpkg ${pkg}.ipkg
@@ -0,0 +1,25 @@
1
+ module Test.HelloWorld
2
+
3
+ import HelloWorld
4
+
5
+ %access export
6
+
7
+ assertEq : Eq a => (given : a) -> (expected : a) -> IO ()
8
+ assertEq g e = putStrLn $ if g == e
9
+ then "Test Passed"
10
+ else "Test Failed"
11
+
12
+ testNothing : IO ()
13
+ testNothing = assertEq (greet Nothing) "Hello, World!"
14
+
15
+ testJustAlice : IO ()
16
+ testJustAlice = assertEq (greet (Just "Alice")) "Hello, Alice!"
17
+
18
+ testJustBob : IO ()
19
+ testJustBob = assertEq (greet (Just "Bob")) "Hello, Bob!"
20
+
21
+ runTests : IO ()
22
+ runTests = do
23
+ testNothing
24
+ testJustAlice
25
+ testJustBob
@@ -0,0 +1,5 @@
1
+ module HelloWorld
2
+
3
+ export
4
+ greet : Maybe String -> String
5
+ greet subject = "Hello, " ++ fromMaybe "World" subject ++ "!"
@@ -18,9 +18,14 @@ addons:
18
18
  apt:
19
19
  packages:
20
20
  - tree
21
+
21
22
  before_install:
22
23
  - rvm install 2.2.5
23
24
  - rvm use 2.2.5
25
+ - bin/build-jq.sh # we want jq 1.5 features; not avail through pkg repo.
26
+
27
+ before_script:
28
+ - export PATH=$TRAVIS_BUILD_DIR/bin:$PATH # ensure our tools are prefered over included ones.
24
29
 
25
30
  script:
26
31
  - bin/unit-tests.sh
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ set -ex
3
+
4
+ pushd bin
5
+ curl --location https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz >jq-1.5.tar.gz
6
+ tar xvf jq-1.5.tar.gz
7
+ cd jq-1.5
8
+ ./configure --disable-maintainer-mode && make
9
+ mv jq ..
10
+ popd
11
+