trackler 2.0.7.0 → 2.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/common/exercises/counter/metadata.yml +0 -4
  4. data/common/exercises/error-handling/metadata.yml +0 -4
  5. data/common/exercises/etl/canonical-data.json +1 -1
  6. data/common/exercises/hello-world/canonical-data.json +9 -21
  7. data/common/exercises/hello-world/description.md +7 -42
  8. data/common/exercises/hello-world/metadata.yml +1 -1
  9. data/common/exercises/lens-person/metadata.yml +0 -3
  10. data/common/exercises/luhn/canonical-data.json +17 -17
  11. data/common/exercises/nucleotide-codons/metadata.yml +0 -2
  12. data/common/exercises/react/metadata.yml +0 -2
  13. data/common/exercises/rectangles/metadata.yml +0 -3
  14. data/common/exercises/variable-length-quantity/metadata.yml +0 -2
  15. data/fixtures/tracks/snowflake/config.json +17 -0
  16. data/fixtures/tracks/snowflake/exercises/snowflake-only/description.md +1 -0
  17. data/fixtures/tracks/snowflake/exercises/snowflake-only/metadata.yml +4 -0
  18. data/lib/trackler/description.rb +27 -0
  19. data/lib/trackler/guaranteed_file.rb +77 -0
  20. data/lib/trackler/implementations.rb +5 -5
  21. data/lib/trackler/metadata.rb +27 -0
  22. data/lib/trackler/null_track.rb +22 -0
  23. data/lib/trackler/problem.rb +32 -34
  24. data/lib/trackler/track.rb +1 -1
  25. data/lib/trackler/version.rb +1 -1
  26. data/tracks/csharp/exercises/hello-world/Example.cs +2 -5
  27. data/tracks/csharp/exercises/hello-world/HelloWorldTest.cs +2 -16
  28. data/tracks/elixir/config.json +7 -0
  29. data/tracks/elixir/exercises/series/example.exs +13 -0
  30. data/tracks/elixir/exercises/series/series.exs +11 -0
  31. data/tracks/elixir/exercises/series/series_test.exs +53 -0
  32. data/tracks/erlang/README.md +3 -3
  33. data/tracks/erlang/config.json +15 -11
  34. data/tracks/erlang/exercises/{binary → all-your-base}/include/exercism.hrl +0 -0
  35. data/tracks/erlang/exercises/{binary → all-your-base}/rebar.config +0 -0
  36. data/tracks/erlang/exercises/{trinary/src/trinary.app.src → all-your-base/src/all_your_base.app.src} +2 -2
  37. data/tracks/erlang/exercises/all-your-base/src/example.erl +33 -0
  38. data/tracks/erlang/exercises/all-your-base/test/all_your_base_tests.erl +69 -0
  39. data/tracks/erlang/exercises/hello-world/src/example.erl +4 -4
  40. data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +3 -12
  41. data/tracks/erlang/exercises/{trinary → rotational-cipher}/include/exercism.hrl +0 -0
  42. data/tracks/erlang/exercises/{trinary → rotational-cipher}/rebar.config +8 -1
  43. data/tracks/erlang/exercises/rotational-cipher/src/example.erl +19 -0
  44. data/tracks/erlang/exercises/{binary/src/binary.app.src → rotational-cipher/src/rotational_cipher.app.src} +2 -2
  45. data/tracks/erlang/exercises/rotational-cipher/test/rotational_cipher_tests.erl +98 -0
  46. data/tracks/fsharp/exercises/grep/GrepTest.fs +57 -0
  47. data/tracks/fsharp/exercises/hello-world/Example.fs +1 -1
  48. data/tracks/fsharp/exercises/hello-world/HelloWorldTest.fs +2 -12
  49. data/tracks/go/.travis.yml +7 -15
  50. data/tracks/go/exercises/hello-world/example.go +4 -8
  51. data/tracks/go/exercises/hello-world/hello_test.go +20 -16
  52. data/tracks/go/exercises/hello-world/hello_world.go +12 -2
  53. data/tracks/groovy/exercises/hello-world/Example.groovy +2 -2
  54. data/tracks/groovy/exercises/hello-world/HelloWorld.groovy +1 -1
  55. data/tracks/groovy/exercises/hello-world/HelloWorldSpec.groovy +1 -14
  56. data/tracks/haskell/config.json +6 -0
  57. data/tracks/haskell/exercises/hello-world/HINTS.md +6 -0
  58. data/tracks/haskell/exercises/hello-world/examples/success-standard/package.yaml +16 -0
  59. data/tracks/haskell/exercises/hello-world/examples/success-standard/src/HelloWorld.hs +4 -0
  60. data/tracks/haskell/exercises/hello-world/package.yaml +19 -0
  61. data/tracks/haskell/exercises/hello-world/src/HelloWorld.hs +4 -0
  62. data/tracks/haskell/exercises/hello-world/stack.yaml +1 -0
  63. data/tracks/haskell/exercises/hello-world/test/Tests.hs +13 -0
  64. data/tracks/idris/config.json +9 -0
  65. data/tracks/idris/exercises/leap/Leap.ipkg +5 -0
  66. data/tracks/idris/exercises/leap/Makefile +23 -0
  67. data/tracks/idris/exercises/leap/src/Leap.idr +5 -0
  68. data/tracks/idris/exercises/leap/src/Test/Leap.idr +37 -0
  69. data/tracks/idris/exercises/leap/src/example.idr +8 -0
  70. data/tracks/{typescript/exercises → java}/.keep +0 -0
  71. data/tracks/java/config.json +115 -172
  72. data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +41 -13
  73. data/tracks/java/exercises/list-ops/build.gradle +18 -0
  74. data/tracks/java/exercises/list-ops/src/example/java/ListOps.java +51 -0
  75. data/tracks/java/exercises/list-ops/src/main/java/.keep +0 -0
  76. data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +316 -0
  77. data/tracks/java/exercises/palindrome-products/src/example/java/Palindromes.java +28 -62
  78. data/tracks/java/exercises/palindrome-products/src/test/java/PalindromesTest.java +26 -83
  79. data/tracks/java/exercises/settings.gradle +1 -0
  80. data/tracks/julia/config.json +1 -2
  81. data/tracks/julia/exercises/hello-world/example.jl +2 -2
  82. data/tracks/julia/exercises/hello-world/runtests.jl +1 -6
  83. data/tracks/lua/exercises/TRACK_HINTS.md +8 -0
  84. data/tracks/lua/exercises/hello-world/example.lua +2 -3
  85. data/tracks/lua/exercises/hello-world/hello-world.lua +18 -0
  86. data/tracks/lua/exercises/hello-world/hello-world_spec.lua +6 -12
  87. data/tracks/ocaml/exercises/phone-number/example.ml +8 -18
  88. data/tracks/ocaml/exercises/phone-number/phone_number.mli +1 -7
  89. data/tracks/ocaml/exercises/phone-number/test.ml +24 -23
  90. data/tracks/ocaml/tools/test-generator/src/special_cases.ml +6 -0
  91. data/tracks/ocaml/tools/test-generator/templates/phone-number/template.ml +21 -0
  92. data/tracks/pony/config.json +2 -2
  93. data/tracks/pony/exercises/hello-world/example.pony +1 -2
  94. data/tracks/pony/exercises/hello-world/test.pony +0 -1
  95. data/tracks/rust/config.json +0 -1
  96. data/tracks/rust/exercises/hello-world/example.rs +2 -5
  97. data/tracks/rust/exercises/hello-world/tests/hello-world.rs +2 -14
  98. data/tracks/scala/config.json +11 -2
  99. data/tracks/scala/docs/LEARNING.md +10 -2
  100. data/tracks/scala/docs/RESOURCES.md +0 -1
  101. data/tracks/scala/docs/TESTS.md +10 -6
  102. data/tracks/scala/exercises/rail-fence-cipher/build.sbt +3 -0
  103. data/tracks/scala/exercises/rail-fence-cipher/example.scala +46 -0
  104. data/tracks/scala/exercises/rail-fence-cipher/src/main/scala/RailFenceCipher.scala +0 -0
  105. data/tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala +42 -0
  106. data/tracks/scala/testgen/src/main/scala/RailFenceCipherTestGenerator.scala +59 -0
  107. data/tracks/typescript/.gitignore +7 -0
  108. data/tracks/typescript/.travis.yml +18 -1
  109. data/tracks/typescript/Dangerfile +43 -0
  110. data/tracks/typescript/Makefile +57 -0
  111. data/tracks/typescript/README.md +38 -5
  112. data/tracks/typescript/SETUP.md +24 -0
  113. data/tracks/typescript/common/package.json +37 -0
  114. data/tracks/typescript/common/tsconfig.json +21 -0
  115. data/tracks/typescript/common/tslint.json +127 -0
  116. data/tracks/typescript/common/yarn.lock +2697 -0
  117. data/tracks/typescript/config.json +82 -2
  118. data/tracks/typescript/docs/ABOUT.md +1 -0
  119. data/tracks/typescript/docs/INSTALLATION.md +17 -0
  120. data/tracks/typescript/docs/LEARNING.md +8 -0
  121. data/tracks/typescript/docs/RESOURCES.md +7 -0
  122. data/tracks/typescript/docs/TESTS.md +36 -0
  123. data/tracks/typescript/exercises/anagram/anagram.example.ts +23 -0
  124. data/tracks/typescript/exercises/anagram/anagram.test.ts +82 -0
  125. data/tracks/typescript/exercises/anagram/package.json +37 -0
  126. data/tracks/typescript/exercises/anagram/tsconfig.json +21 -0
  127. data/tracks/typescript/exercises/anagram/tslint.json +127 -0
  128. data/tracks/typescript/exercises/anagram/yarn.lock +2697 -0
  129. data/tracks/typescript/exercises/beer-song/beer-song.example.ts +36 -0
  130. data/tracks/typescript/exercises/beer-song/beer-song.test.ts +360 -0
  131. data/tracks/typescript/exercises/beer-song/package.json +37 -0
  132. data/tracks/typescript/exercises/beer-song/tsconfig.json +21 -0
  133. data/tracks/typescript/exercises/beer-song/tslint.json +127 -0
  134. data/tracks/typescript/exercises/beer-song/yarn.lock +2697 -0
  135. data/tracks/typescript/exercises/bob/bob.example.ts +24 -0
  136. data/tracks/typescript/exercises/bob/bob.test.ts +92 -0
  137. data/tracks/typescript/exercises/bob/package.json +37 -0
  138. data/tracks/typescript/exercises/bob/tsconfig.json +21 -0
  139. data/tracks/typescript/exercises/bob/tslint.json +127 -0
  140. data/tracks/typescript/exercises/bob/yarn.lock +2697 -0
  141. data/tracks/typescript/exercises/gigasecond/gigasecond.example.ts +11 -0
  142. data/tracks/typescript/exercises/gigasecond/gigasecond.test.ts +29 -0
  143. data/tracks/typescript/exercises/gigasecond/package.json +37 -0
  144. data/tracks/typescript/exercises/gigasecond/tsconfig.json +21 -0
  145. data/tracks/typescript/exercises/gigasecond/tslint.json +127 -0
  146. data/tracks/typescript/exercises/gigasecond/yarn.lock +2697 -0
  147. data/tracks/typescript/exercises/hamming/hamming.example.ts +19 -0
  148. data/tracks/typescript/exercises/hamming/hamming.test.ts +39 -0
  149. data/tracks/typescript/exercises/hamming/package.json +37 -0
  150. data/tracks/typescript/exercises/hamming/tsconfig.json +21 -0
  151. data/tracks/typescript/exercises/hamming/tslint.json +127 -0
  152. data/tracks/typescript/exercises/hamming/yarn.lock +2697 -0
  153. data/tracks/typescript/exercises/hello-world/hello-world.example.ts +8 -0
  154. data/tracks/typescript/exercises/hello-world/hello-world.test.ts +17 -0
  155. data/tracks/typescript/exercises/hello-world/package.json +37 -0
  156. data/tracks/typescript/exercises/hello-world/tsconfig.json +21 -0
  157. data/tracks/typescript/exercises/hello-world/tslint.json +127 -0
  158. data/tracks/typescript/exercises/hello-world/yarn.lock +2697 -0
  159. data/tracks/typescript/exercises/leap/leap.example.ts +6 -0
  160. data/tracks/typescript/exercises/leap/leap.test.ts +39 -0
  161. data/tracks/typescript/exercises/leap/package.json +37 -0
  162. data/tracks/typescript/exercises/leap/tsconfig.json +21 -0
  163. data/tracks/typescript/exercises/leap/tslint.json +127 -0
  164. data/tracks/typescript/exercises/leap/yarn.lock +2697 -0
  165. data/tracks/typescript/exercises/pangram/package.json +37 -0
  166. data/tracks/typescript/exercises/pangram/pangram.example.ts +32 -0
  167. data/tracks/typescript/exercises/pangram/pangram.test.ts +50 -0
  168. data/tracks/typescript/exercises/pangram/tsconfig.json +21 -0
  169. data/tracks/typescript/exercises/pangram/tslint.json +127 -0
  170. data/tracks/typescript/exercises/pangram/yarn.lock +2697 -0
  171. data/tracks/typescript/exercises/phone-number/package.json +37 -0
  172. data/tracks/typescript/exercises/phone-number/phone-number.example.ts +21 -0
  173. data/tracks/typescript/exercises/phone-number/phone-number.test.ts +55 -0
  174. data/tracks/typescript/exercises/phone-number/tsconfig.json +21 -0
  175. data/tracks/typescript/exercises/phone-number/tslint.json +127 -0
  176. data/tracks/typescript/exercises/phone-number/yarn.lock +2697 -0
  177. data/tracks/typescript/exercises/rna-transcription/package.json +37 -0
  178. data/tracks/typescript/exercises/rna-transcription/rna-transcription.example.ts +13 -0
  179. data/tracks/typescript/exercises/rna-transcription/rna-transcription.test.ts +45 -0
  180. data/tracks/typescript/exercises/rna-transcription/tsconfig.json +21 -0
  181. data/tracks/typescript/exercises/rna-transcription/tslint.json +127 -0
  182. data/tracks/typescript/exercises/rna-transcription/yarn.lock +2697 -0
  183. data/tracks/typescript/exercises/say/package.json +37 -0
  184. data/tracks/typescript/exercises/say/say.example.ts +95 -0
  185. data/tracks/typescript/exercises/say/say.test.ts +78 -0
  186. data/tracks/typescript/exercises/say/tsconfig.json +21 -0
  187. data/tracks/typescript/exercises/say/tslint.json +127 -0
  188. data/tracks/typescript/exercises/say/yarn.lock +2697 -0
  189. data/tracks/typescript/exercises/word-count/package.json +37 -0
  190. data/tracks/typescript/exercises/word-count/tsconfig.json +21 -0
  191. data/tracks/typescript/exercises/word-count/tslint.json +127 -0
  192. data/tracks/typescript/exercises/word-count/word-count.example.ts +16 -0
  193. data/tracks/typescript/exercises/word-count/word-count.test.ts +65 -0
  194. data/tracks/typescript/exercises/word-count/yarn.lock +2697 -0
  195. data/tracks/typescript/exercises/wordy/package.json +37 -0
  196. data/tracks/typescript/exercises/wordy/tsconfig.json +21 -0
  197. data/tracks/typescript/exercises/wordy/tslint.json +127 -0
  198. data/tracks/typescript/exercises/wordy/wordy.example.ts +40 -0
  199. data/tracks/typescript/exercises/wordy/wordy.test.ts +89 -0
  200. data/tracks/typescript/exercises/wordy/yarn.lock +2697 -0
  201. data/tracks/typescript/img/icon.png +0 -0
  202. data/tracks/typescript/img/icon.svg +10 -0
  203. metadata +134 -15
  204. data/tracks/erlang/exercises/binary/src/example.erl +0 -20
  205. data/tracks/erlang/exercises/binary/test/binary_string_tests.erl +0 -26
  206. data/tracks/erlang/exercises/trinary/Makefile +0 -10
  207. data/tracks/erlang/exercises/trinary/src/example.erl +0 -66
  208. data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +0 -36
  209. data/tracks/fsharp/exercises/hello-world/HINTS.md +0 -5
@@ -1,8 +1,8 @@
1
1
  -module(example).
2
- -export([greet/0, greet/1, test_version/0]).
2
+ -export([hello/0, test_version/0]).
3
3
 
4
- greet() -> "Hello, World!".
5
- greet(Name) -> "Hello, " ++ Name ++ "!".
4
+ hello() ->
5
+ "Hello, World!".
6
6
 
7
7
  test_version() ->
8
- 1.
8
+ 2.
@@ -1,18 +1,9 @@
1
1
  -module(hello_world_tests).
2
2
 
3
3
  -define(TESTED_MODULE, (sut(hello_world))).
4
- -define(TEST_VERSION, 1).
4
+ -define(TEST_VERSION, 2).
5
5
  -include("exercism.hrl").
6
6
 
7
7
 
8
- no_name_test() ->
9
- ?assertEqual("Hello, World!", ?TESTED_MODULE:greet()).
10
-
11
- alice_test() ->
12
- ?assertEqual("Hello, Alice!", ?TESTED_MODULE:greet("Alice")).
13
-
14
- bob_test() ->
15
- ?assertEqual("Hello, Bob!", ?TESTED_MODULE:greet("Bob")).
16
-
17
- strange_test() ->
18
- ?assertEqual("Hello, !", ?TESTED_MODULE:greet("")).
8
+ say_hi_test() ->
9
+ ?assertEqual("Hello, World!", ?TESTED_MODULE:hello()).
@@ -1,7 +1,12 @@
1
1
  %% Erlang compiler options
2
2
  {erl_opts, [debug_info]}.
3
3
 
4
- {deps, []}.
4
+ {plugins, [rebar3_proper, rebar_alias]}.
5
+ {deps, [{proper, "1.1.1-beta"}]}.
6
+
7
+ {alias, [
8
+ {test, [eunit, proper]}
9
+ ]}.
5
10
 
6
11
  {dialyzer, [
7
12
  {warnings, [underspecs, no_return]},
@@ -20,6 +25,8 @@
20
25
  %% Options for eunit:test(Tests, Opts)
21
26
  {eunit_opts, [verbose]}.
22
27
 
28
+ {proper_opts, [{module, [rotational_cipher_tests]}]}.
29
+
23
30
  %% == xref ==
24
31
 
25
32
  {xref_warnings, true}.
@@ -0,0 +1,19 @@
1
+ -module(example).
2
+
3
+ -export([encrypt/2, decrypt/2, test_version/0]).
4
+
5
+ encrypt(String, N) ->
6
+ lists:map(fun
7
+ (C) when $a =< C, C =< $z ->
8
+ ((C - $a + N) rem 26) + $a;
9
+ (C) when $A =< C, C =< $Z ->
10
+ ((C - $A + N) rem 26) + $A;
11
+ (C) ->
12
+ C
13
+ end, String).
14
+
15
+ decrypt(String, N) ->
16
+ encrypt(String, 26 - N).
17
+
18
+ test_version() ->
19
+ 1.
@@ -1,5 +1,5 @@
1
- {application, binary,
2
- [{description, "exercism.io - binary"},
1
+ {application, rotational_cipher,
2
+ [{description, "exercism.io - rotational-cipher"},
3
3
  {vsn, "git"},
4
4
  {modules, []},
5
5
  {registered, []},
@@ -0,0 +1,98 @@
1
+ -module(rotational_cipher_tests).
2
+
3
+ -define(TESTED_MODULE, (sut(rotational_cipher))).
4
+ -define(TEST_VERSION, 1).
5
+ -include_lib("proper/include/proper.hrl").
6
+ -include("exercism.hrl").
7
+
8
+ %%% To use this testsuite completely do run
9
+ %%% rebar3 do eunit, proper
10
+
11
+
12
+ %%% These tests are inspired by
13
+ %%% https://github.com/exercism/x-common/blob/932c674a0554ad0db3645e9d2a473a515876d6eb/exercises/rotational-cipher/canonical-data.json
14
+ %%% But don't have a generic `rotate/2` function, but split the tests into
15
+ %%% encryption and decryption.
16
+ %%% Also some property based tests are added into the mix.
17
+
18
+ %% Encryption tests
19
+
20
+ encrypt_a_by_1_test() ->
21
+ ?assertEqual("b", ?TESTED_MODULE:encrypt("a", 1)).
22
+
23
+ encrypt_a_by_26_same_output_as_input_test() ->
24
+ ?assertEqual("a", ?TESTED_MODULE:encrypt("a", 26)).
25
+
26
+ encrypt_a_by_0_same_output_as_input_test() ->
27
+ ?assertEqual("a", ?TESTED_MODULE:encrypt("a", 0)).
28
+
29
+ encrypt_m_by_13_test() ->
30
+ ?assertEqual("m", ?TESTED_MODULE:encrypt("z", 13)).
31
+
32
+ encrypt_wraps_alphabet_test() ->
33
+ ?assertEqual("a", ?TESTED_MODULE:encrypt("z", 1)).
34
+
35
+ encrypt_capital_letters_test() ->
36
+ ?assertEqual("TRL", ?TESTED_MODULE:encrypt("OMG", 5)).
37
+
38
+ encrypt_spaces_test() ->
39
+ ?assertEqual("T R L", ?TESTED_MODULE:encrypt("O M G", 5)).
40
+
41
+ encrypt_numbers_test() ->
42
+ ?assertEqual("Xiwxmrk 1 2 3 xiwxmrk", ?TESTED_MODULE:encrypt("Testing 1 2 3 testing", 4)).
43
+
44
+ encrypt_punctuation_test() ->
45
+ ?assertEqual("Gzo'n zvo, Bmviyhv!", ?TESTED_MODULE:encrypt("Let's eat, Grandma!", 21)).
46
+
47
+ encrypt_all_letters_test() ->
48
+ ?assertEqual("Gur dhvpx oebja sbk whzcf bire gur ynml qbt.", ?TESTED_MODULE:encrypt("The quick brown fox jumps over the lazy dog.", 13)).
49
+
50
+ %% Decryption tests
51
+
52
+ decrypt_b_by_1_test() ->
53
+ ?assertEqual("a", ?TESTED_MODULE:decrypt("b", 1)).
54
+
55
+ decrypt_a_by_26_same_output_as_input_test() ->
56
+ ?assertEqual("a", ?TESTED_MODULE:decrypt("a", 26)).
57
+
58
+ decrypt_a_by_0_same_output_as_input_test() ->
59
+ ?assertEqual("a", ?TESTED_MODULE:decrypt("a", 0)).
60
+
61
+ decrypt_z_by_13_test() ->
62
+ ?assertEqual("z", ?TESTED_MODULE:decrypt("m", 13)).
63
+
64
+ decrypt_wraps_alphabet_test() ->
65
+ ?assertEqual("z", ?TESTED_MODULE:decrypt("a", 1)).
66
+
67
+ decrypt_capital_letters_test() ->
68
+ ?assertEqual("OMG", ?TESTED_MODULE:decrypt("TRL", 5)).
69
+
70
+ decrypt_spaces_test() ->
71
+ ?assertEqual("O M G", ?TESTED_MODULE:decrypt("T R L", 5)).
72
+
73
+ decrypt_numbers_test() ->
74
+ ?assertEqual("Testing 1 2 3 testing", ?TESTED_MODULE:decrypt("Xiwxmrk 1 2 3 xiwxmrk", 4)).
75
+
76
+ decrypt_punctuation_test() ->
77
+ ?assertEqual("Let's eat, Grandma!", ?TESTED_MODULE:decrypt("Gzo'n zvo, Bmviyhv!", 21)).
78
+
79
+ decrypt_all_letters_test() ->
80
+ ?assertEqual("The quick brown fox jumps over the lazy dog.", ?TESTED_MODULE:decrypt("Gur dhvpx oebja sbk whzcf bire gur ynml qbt.", 13)).
81
+
82
+ %% Properties tested via `proper`
83
+
84
+ prop_decrypt_encrypt_is_id() ->
85
+ ?FORALL({Input, N}, {string(), integer(0,26)},
86
+ ?TESTED_MODULE:decrypt(?TESTED_MODULE:encrypt(Input, N), N) == Input).
87
+
88
+ prop_decrypt_is_encrypt_with_another_key() ->
89
+ ?FORALL({Input, N}, {string(), integer(0,26)},
90
+ ?TESTED_MODULE:decrypt(Input, 26 - N) == ?TESTED_MODULE:encrypt(Input, N)).
91
+
92
+ prop_encrypt_13_twice_is_id() ->
93
+ ?FORALL(Input, string(),
94
+ ?TESTED_MODULE:encrypt(?TESTED_MODULE:encrypt(Input, 13), 13) == Input).
95
+
96
+ prop_decrypt_13_twice_is_id() ->
97
+ ?FORALL(Input, string(),
98
+ ?TESTED_MODULE:decrypt(?TESTED_MODULE:decrypt(Input, 13), 13) == Input).
@@ -192,6 +192,63 @@ let ``One file, several matches, inverted flag`` () =
192
192
  "That Shepherd, who first taught the chosen Seed\n"
193
193
 
194
194
  Assert.That(grep pattern flags files, Is.EqualTo(expected))
195
+
196
+ [<Test>]
197
+ [<Ignore("Remove to run test")>]
198
+ let ``One file, case-insensitive and entire line flags`` () =
199
+ let pattern = "ATREUS"
200
+ let files = [iliadFileName]
201
+ let flags = "-i -x"
202
+ let expected = ""
203
+
204
+ Assert.That(grep pattern flags files, Is.EqualTo(expected))
205
+
206
+ [<Test>]
207
+ [<Ignore("Remove to run test")>]
208
+ let ``One file, case-insensitive and inverted flags`` () =
209
+ let pattern = "THE"
210
+ let files = [paradiseLostFileName]
211
+ let flags = "-i -v"
212
+ let expected =
213
+ "Of that Forbidden Tree, whose mortal tast\n" +
214
+ "With loss of Eden, till one greater Man\n" +
215
+ "Of Oreb, or of Sinai, didst inspire\n"
216
+
217
+ Assert.That(grep pattern flags files, Is.EqualTo(expected))
218
+
219
+ [<Test>]
220
+ [<Ignore("Remove to run test")>]
221
+ let ``One file, inverted and entire line flags`` () =
222
+ let pattern = "the"
223
+ let files = [paradiseLostFileName]
224
+ let flags = "-v -x"
225
+ let expected =
226
+ "Of Mans First Disobedience, and the Fruit\n" +
227
+ "Of that Forbidden Tree, whose mortal tast\n" +
228
+ "Brought Death into the World, and all our woe,\n" +
229
+ "With loss of Eden, till one greater Man\n" +
230
+ "Restore us, and regain the blissful Seat,\n" +
231
+ "Sing Heav'nly Muse, that on the secret top\n" +
232
+ "Of Oreb, or of Sinai, didst inspire\n" +
233
+ "That Shepherd, who first taught the chosen Seed\n"
234
+
235
+ Assert.That(grep pattern flags files, Is.EqualTo(expected))
236
+
237
+ [<Test>]
238
+ [<Ignore("Remove to run test")>]
239
+ let ``One file, case-insensitive, inverted and entire line flags`` () =
240
+ let pattern = "if i rEFuse To Wed DeMETrius."
241
+ let files = [midsummerNightFileName]
242
+ let flags = "-i -v -x"
243
+ let expected =
244
+ "I do entreat your grace to pardon me.\n" +
245
+ "I know not by what power I am made bold,\n" +
246
+ "Nor how it may concern my modesty,\n" +
247
+ "In such a presence here to plead my thoughts;\n" +
248
+ "But I beseech your grace that I may know\n" +
249
+ "The worst that may befall me in this case,\n"
250
+
251
+ Assert.That(grep pattern flags files, Is.EqualTo(expected))
195
252
 
196
253
  [<TestCase("", Ignore = "Remove to run test case")>]
197
254
  [<TestCase("-n", Ignore = "Remove to run test case")>]
@@ -1,3 +1,3 @@
1
1
  module HelloWorld
2
2
 
3
- let hello name = sprintf "Hello, %s!" (defaultArg name "World")
3
+ let hello = "Hello, World!"
@@ -5,15 +5,5 @@ open NUnit.Framework
5
5
  open HelloWorld
6
6
 
7
7
  [<Test>]
8
- let ``No name`` () =
9
- Assert.That(hello None, Is.EqualTo("Hello, World!"))
10
-
11
- [<Test>]
12
- [<Ignore("Remove to run test")>]
13
- let ``Sample name`` () =
14
- Assert.That(hello (Some "Alice"), Is.EqualTo("Hello, Alice!"))
15
-
16
- [<Test>]
17
- [<Ignore("Remove to run test")>]
18
- let ``Other sample name`` () =
19
- Assert.That(hello (Some "Bob"), Is.EqualTo("Hello, Bob!"))
8
+ let ``Say hi!`` () =
9
+ Assert.That(hello, Is.EqualTo("Hello, World!"))
@@ -14,15 +14,12 @@ sudo: false
14
14
  # to alert us to any real upcoming change in the language that would be
15
15
  # incompatible with our existing code.
16
16
  #
17
- # We may choose to test additional versions as time allows,
18
- # as long as the number of entries in the build matrix doesn't exceed ten.
19
- # These additional versions will not be required, so they're advisory only.
20
- # Since Travis runs five jobs at a time, a limit of ten jobs makes sense.
17
+ # We used to test additional versions beyond the last two,
18
+ # but since Travis only runs five jobs at a time throughout all of Exercism,
19
+ # it is better citizenship to not test the additional versions.
21
20
  go:
22
- - 1.7
23
- - 1.6.3
24
- - 1.5.4
25
- - 1.4.3
21
+ - 1.7.5
22
+ - 1.8
26
23
  - tip
27
24
 
28
25
  # Travis runs in a 64 bit environment but beginning with Go 1.5, building a
@@ -58,18 +55,13 @@ script:
58
55
  - if [ -n "$STATIC_CHECKERS" ]; then ./bin/test-without-stubs vet; fi
59
56
  - if [ -z "$STATIC_CHECKERS" ]; then ./bin/test-without-stubs; fi
60
57
 
61
- # special cases for the build matrix are that go 1.4.3 can't be tested 32 bit
58
+ # special cases for the build matrix are STATIC_CHECKERS gets its own entry
62
59
  # and that tip is allowed to fail. Broken tips are extremely rare these days
63
60
  # but anyway, it could happen and it wouldn't be our problem.
64
61
  matrix:
65
- exclude:
66
- - go: 1.4.3
67
- env: TESTARCH=386
68
62
  include:
69
63
  # Keep this in sync with the latest version.
70
- - go: 1.7
64
+ - go: 1.8
71
65
  env: STATIC_CHECKERS=1
72
66
  allow_failures:
73
67
  - go: tip
74
- - go: 1.4.3
75
- - go: 1.5.4
@@ -1,12 +1,8 @@
1
1
  package greeting
2
2
 
3
- const testVersion = 3
3
+ const testVersion = 4
4
4
 
5
- // HelloWorld says hello to given name.
6
- // If no name is passed, it greets the world.
7
- func HelloWorld(name string) string {
8
- if name == "" {
9
- name = "World"
10
- }
11
- return "Hello, " + name + "!"
5
+ // HelloWorld greets the world.
6
+ func HelloWorld() string {
7
+ return "Hello, World!"
12
8
  }
@@ -2,13 +2,25 @@ package greeting
2
2
 
3
3
  import "testing"
4
4
 
5
- // Define a function HelloWorld(string) string.
5
+ // Define a function named HelloWorld that takes no arguments,
6
+ // and returns a string.
7
+ // In other words, define a function with the following signature:
8
+ // HelloWorld() string
6
9
  //
7
- // Also define a testVersion with a value that matches
8
- // the targetTestVersion here.
9
-
10
- const targetTestVersion = 3
10
+ // In any exercise solution using the following tests you must also define a
11
+ // "testVersion" constant with a value that matches the targetTestVersion
12
+ // here. See how it is done in the the ./hello_world.go file provided.
13
+ // This is a common convention for ensuring test consistency throughout the
14
+ // Exercism Go language track.
15
+ //
16
+ // See TestTestVersion function below for how this and the testVersion
17
+ // constants are used.
18
+ const targetTestVersion = 4
11
19
 
20
+ // TestTestVersion is used to ensure the exercise solution is considered
21
+ // compatible with the rest of the tests. It should be the initial testing
22
+ // function in any test suite. If there is an incompatibility the tests can
23
+ // be considered unreliable therefore this function will abort the testing.
12
24
  func TestTestVersion(t *testing.T) {
13
25
  if testVersion != targetTestVersion {
14
26
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
@@ -16,16 +28,8 @@ func TestTestVersion(t *testing.T) {
16
28
  }
17
29
 
18
30
  func TestHelloWorld(t *testing.T) {
19
- tests := []struct {
20
- name, expected string
21
- }{
22
- {"", "Hello, World!"},
23
- {"Gopher", "Hello, Gopher!"},
24
- {"ゴーファー", "Hello, ゴーファー!"},
25
- }
26
- for _, test := range tests {
27
- if observed := HelloWorld(test.name); observed != test.expected {
28
- t.Fatalf("HelloWorld(%s) = %v, want %v", test.name, observed, test.expected)
29
- }
31
+ expected := "Hello, World!"
32
+ if observed := HelloWorld(); observed != expected {
33
+ t.Fatalf("HelloWorld() = %v, want %v", observed, expected)
30
34
  }
31
35
  }
@@ -10,10 +10,20 @@ package greeting
10
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
- const testVersion = 3
13
+ //
14
+ // This is a convention done for Exercism exercises in the Go language track,
15
+ // it is not a requirement of the Go programming language.
16
+ //
17
+ // This test versioning setup will be common to all the exercises in the
18
+ // Go language track. When crafting your own solution file from scratch you
19
+ // will be expected to add this constant or the initial test will fail.
20
+ // The version number you should use will be found in the constant
21
+ // "targetTestVersion" in the test file, see ./hello_test.go for more
22
+ // information.
23
+ const testVersion = 4
14
24
 
15
25
  // HelloWorld needs a comment documenting it as package does.
16
- func HelloWorld(string) string {
26
+ func HelloWorld() string {
17
27
  // Write some code here to pass the test suite.
18
28
 
19
29
  // When you have a working solution, REMOVE ALL THE STOCK COMMENTS.
@@ -1,7 +1,7 @@
1
1
  class HelloWorld {
2
2
 
3
- def hello(name = 'World') {
4
- "Hello, ${name}!"
3
+ def hello() {
4
+ 'Hello, World!'
5
5
  }
6
6
 
7
7
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  class HelloWorld {
4
4
 
5
- def hello(name) {
5
+ def hello() {
6
6
  // YOUR CODE HERE
7
7
  }
8
8
 
@@ -3,21 +3,8 @@ import spock.lang.*
3
3
 
4
4
  class HelloWorldSpec extends Specification {
5
5
 
6
- @Shared
7
- def hello = new HelloWorld()
8
-
9
6
  def 'outputs "Hello, World!"'() {
10
- expect: hello.hello() == 'Hello, World!'
11
- }
12
-
13
- @Ignore
14
- def 'outputs "Hello, Alice!" when given the name "Alice"'() {
15
- expect: hello.hello('Alice') == 'Hello, Alice!'
16
- }
17
-
18
- @Ignore
19
- def 'outputs "Hello, Bob!" when given the name "Bob"'() {
20
- expect: hello.hello('Bob') == 'Hello, Bob!'
7
+ expect: new HelloWorld().hello() == 'Hello, World!'
21
8
  }
22
9
 
23
10
  }