trackler 2.2.1.95 → 2.2.1.96

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/two-bucket/canonical-data.json +31 -31
  4. data/tracks/csharp/docs/ABOUT.md +21 -3
  5. data/tracks/dart/.travis.yml +1 -2
  6. data/tracks/dart/README.md +2 -2
  7. data/tracks/dart/{tool/create-exercise → bin/create_exercise.dart} +14 -10
  8. data/tracks/dart/test/create_exercise_test.dart +132 -0
  9. data/tracks/dart/test/exercises_test.dart +1 -1
  10. data/tracks/fsharp/exercises/list-ops/Example.fs +5 -5
  11. data/tracks/fsharp/exercises/list-ops/ListOps.fs +1 -1
  12. data/tracks/fsharp/exercises/list-ops/ListOpsTest.fs +41 -62
  13. data/tracks/fsharp/generators/Common.fs +3 -0
  14. data/tracks/fsharp/generators/Formatting.fs +3 -1
  15. data/tracks/fsharp/generators/Generators.fs +21 -0
  16. data/tracks/go/config.json +14 -0
  17. data/tracks/go/exercises/grep/.meta/gen.go +76 -0
  18. data/tracks/go/exercises/grep/.meta/hints.md +13 -0
  19. data/tracks/go/exercises/grep/README.md +104 -0
  20. data/tracks/go/exercises/grep/cases_test.go +202 -0
  21. data/tracks/go/exercises/grep/example.go +102 -0
  22. data/tracks/go/exercises/grep/grep_test.go +84 -0
  23. data/tracks/java/exercises/anagram/.meta/version +1 -1
  24. data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +0 -32
  25. data/tracks/java/exercises/space-age/.meta/src/reference/java/SpaceAge.java +0 -4
  26. data/tracks/java/exercises/space-age/.meta/version +1 -0
  27. data/tracks/java/exercises/space-age/src/test/java/SpaceAgeTest.java +0 -16
  28. data/tracks/julia/.gitignore +1 -0
  29. data/tracks/julia/exercises/complex-numbers/{HINTS.md → .meta/hints.md} +0 -0
  30. data/tracks/julia/exercises/custom-set/{HINTS.md → .meta/hints.md} +0 -0
  31. data/tracks/julia/exercises/robot-name/{HINTS.md → .meta/hints.md} +0 -0
  32. data/tracks/julia/exercises/rotational-cipher/{HINTS.md → .meta/hints.md} +0 -0
  33. data/tracks/julia/runtests.jl +24 -25
  34. data/tracks/perl6/.travis.yml +7 -3
  35. data/tracks/perl6/Dockerfile +4 -0
  36. data/tracks/perl6/exercises/accumulate/Accumulate.pm6 +1 -1
  37. data/tracks/perl6/exercises/accumulate/Example.pm6 +1 -1
  38. data/tracks/perl6/exercises/accumulate/accumulate.t +6 -15
  39. data/tracks/perl6/exercises/accumulate/example.yaml +2 -3
  40. data/tracks/perl6/exercises/acronym/Acronym.pm6 +1 -1
  41. data/tracks/perl6/exercises/acronym/Example.pm6 +1 -1
  42. data/tracks/perl6/exercises/acronym/acronym.t +7 -29
  43. data/tracks/perl6/exercises/acronym/example.yaml +2 -3
  44. data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +1 -1
  45. data/tracks/perl6/exercises/all-your-base/Example.pm6 +1 -1
  46. data/tracks/perl6/exercises/all-your-base/all-your-base.t +7 -29
  47. data/tracks/perl6/exercises/all-your-base/example.yaml +2 -3
  48. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
  49. data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
  50. data/tracks/perl6/exercises/allergies/allergies.t +7 -29
  51. data/tracks/perl6/exercises/allergies/example.yaml +2 -3
  52. data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -1
  53. data/tracks/perl6/exercises/anagram/Example.pm6 +1 -1
  54. data/tracks/perl6/exercises/anagram/anagram.t +7 -29
  55. data/tracks/perl6/exercises/anagram/example.yaml +2 -3
  56. data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -1
  57. data/tracks/perl6/exercises/atbash-cipher/Example.pm6 +1 -1
  58. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +7 -29
  59. data/tracks/perl6/exercises/atbash-cipher/example.yaml +2 -3
  60. data/tracks/{julia/exercises/.keep → perl6/exercises/binary/Binary.pm6} +0 -0
  61. data/tracks/perl6/exercises/binary/binary.t +3 -5
  62. data/tracks/perl6/exercises/bob/Bob.pm6 +1 -1
  63. data/tracks/perl6/exercises/bob/Example.pm6 +1 -1
  64. data/tracks/perl6/exercises/bob/bob.t +9 -32
  65. data/tracks/perl6/exercises/bob/example.yaml +3 -7
  66. data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
  67. data/tracks/perl6/exercises/clock/Example.pm6 +1 -1
  68. data/tracks/perl6/exercises/clock/clock.t +12 -32
  69. data/tracks/perl6/exercises/clock/example.yaml +6 -6
  70. data/tracks/perl6/exercises/etl/ETL.pm6 +1 -1
  71. data/tracks/perl6/exercises/etl/Example.pm6 +1 -1
  72. data/tracks/perl6/exercises/etl/etl.t +7 -29
  73. data/tracks/perl6/exercises/etl/example.yaml +2 -3
  74. data/tracks/perl6/exercises/flatten-array/Example.pm6 +1 -1
  75. data/tracks/perl6/exercises/flatten-array/FlattenArray.pm6 +1 -1
  76. data/tracks/perl6/exercises/flatten-array/example.yaml +2 -3
  77. data/tracks/perl6/exercises/flatten-array/flatten-array.t +7 -29
  78. data/tracks/perl6/exercises/grade-school/Example.pm6 +1 -1
  79. data/tracks/perl6/exercises/grade-school/GradeSchool.pm6 +1 -1
  80. data/tracks/perl6/exercises/grade-school/example.yaml +2 -3
  81. data/tracks/perl6/exercises/grade-school/grade-school.t +6 -15
  82. data/tracks/perl6/exercises/grains/Example.pm6 +1 -1
  83. data/tracks/perl6/exercises/grains/Grains.pm6 +1 -1
  84. data/tracks/perl6/exercises/grains/example.yaml +2 -3
  85. data/tracks/perl6/exercises/grains/grains.t +7 -29
  86. data/tracks/perl6/exercises/hamming/Example.pm6 +1 -1
  87. data/tracks/perl6/exercises/hamming/Hamming.pm6 +1 -1
  88. data/tracks/perl6/exercises/hamming/example.yaml +2 -3
  89. data/tracks/perl6/exercises/hamming/hamming.t +7 -29
  90. data/tracks/perl6/exercises/hello-world/Example.pm6 +1 -1
  91. data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +1 -1
  92. data/tracks/perl6/exercises/hello-world/example.yaml +2 -8
  93. data/tracks/perl6/exercises/hello-world/hello-world.t +7 -33
  94. data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
  95. data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
  96. data/tracks/perl6/exercises/leap/example.yaml +2 -3
  97. data/tracks/perl6/exercises/leap/leap.t +7 -29
  98. data/tracks/perl6/exercises/linked-list/Example.pm6 +1 -1
  99. data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -1
  100. data/tracks/perl6/exercises/linked-list/example.yaml +3 -3
  101. data/tracks/perl6/exercises/linked-list/linked-list.t +9 -16
  102. data/tracks/perl6/exercises/luhn/Example.pm6 +1 -1
  103. data/tracks/perl6/exercises/luhn/Luhn.pm6 +1 -1
  104. data/tracks/perl6/exercises/luhn/example.yaml +2 -3
  105. data/tracks/perl6/exercises/luhn/luhn.t +7 -29
  106. data/tracks/perl6/exercises/meetup/Example.pm6 +1 -1
  107. data/tracks/perl6/exercises/meetup/Meetup.pm6 +1 -1
  108. data/tracks/perl6/exercises/meetup/example.yaml +2 -3
  109. data/tracks/perl6/exercises/meetup/meetup.t +7 -29
  110. data/tracks/perl6/exercises/nucleotide-count/Example.pm6 +1 -1
  111. data/tracks/perl6/exercises/nucleotide-count/NucleotideCount.pm6 +1 -1
  112. data/tracks/perl6/exercises/nucleotide-count/example.yaml +2 -3
  113. data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +7 -29
  114. data/tracks/perl6/exercises/pangram/Example.pm6 +1 -1
  115. data/tracks/perl6/exercises/pangram/Pangram.pm6 +1 -1
  116. data/tracks/perl6/exercises/pangram/example.yaml +2 -3
  117. data/tracks/perl6/exercises/pangram/pangram.t +7 -29
  118. data/tracks/perl6/exercises/phone-number/Example.pm6 +1 -1
  119. data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
  120. data/tracks/perl6/exercises/phone-number/example.yaml +2 -3
  121. data/tracks/perl6/exercises/phone-number/phone-number.t +7 -29
  122. data/tracks/perl6/exercises/raindrops/Example.pm6 +1 -1
  123. data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +1 -1
  124. data/tracks/perl6/exercises/raindrops/example.yaml +2 -3
  125. data/tracks/perl6/exercises/raindrops/raindrops.t +7 -29
  126. data/tracks/perl6/exercises/rna-transcription/Example.pm6 +1 -1
  127. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +1 -1
  128. data/tracks/perl6/exercises/rna-transcription/example.yaml +2 -3
  129. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +7 -29
  130. data/tracks/perl6/exercises/robot-name/Example.pm6 +1 -1
  131. data/tracks/perl6/exercises/robot-name/Robot.pm6 +1 -1
  132. data/tracks/perl6/exercises/robot-name/example.yaml +5 -5
  133. data/tracks/perl6/exercises/robot-name/robot-name.t +10 -17
  134. data/tracks/perl6/exercises/roman-numerals/Example.pm6 +1 -1
  135. data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
  136. data/tracks/perl6/exercises/roman-numerals/example.yaml +2 -3
  137. data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +7 -29
  138. data/tracks/perl6/exercises/scrabble-score/Example.pm6 +1 -1
  139. data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +1 -1
  140. data/tracks/perl6/exercises/scrabble-score/example.yaml +2 -3
  141. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +7 -29
  142. data/tracks/perl6/exercises/space-age/Example.pm6 +1 -1
  143. data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +1 -1
  144. data/tracks/perl6/exercises/space-age/example.yaml +2 -3
  145. data/tracks/perl6/exercises/space-age/space-age.t +7 -29
  146. data/tracks/perl6/exercises/trinary/Trinary.pm6 +0 -0
  147. data/tracks/perl6/exercises/trinary/trinary.t +2 -5
  148. data/tracks/perl6/exercises/two-fer/Example.pm6 +1 -1
  149. data/tracks/perl6/exercises/two-fer/TwoFer.pm6 +1 -1
  150. data/tracks/perl6/exercises/two-fer/example.yaml +2 -8
  151. data/tracks/perl6/exercises/two-fer/two-fer.t +7 -33
  152. data/tracks/perl6/exercises/word-count/Example.pm6 +1 -1
  153. data/tracks/perl6/exercises/word-count/WordCount.pm6 +1 -1
  154. data/tracks/perl6/exercises/word-count/example.yaml +2 -3
  155. data/tracks/perl6/exercises/word-count/word-count.t +7 -29
  156. data/tracks/perl6/exercises/wordy/Example.pm6 +1 -1
  157. data/tracks/perl6/exercises/wordy/Wordy.pm6 +1 -1
  158. data/tracks/perl6/exercises/wordy/example.yaml +2 -3
  159. data/tracks/perl6/exercises/wordy/wordy.t +7 -29
  160. data/tracks/perl6/templates/test.mustache +10 -39
  161. data/tracks/python/config.json +10 -0
  162. data/tracks/python/exercises/all-your-base/all_your_base_test.py +2 -2
  163. data/tracks/python/exercises/binary-search/binary_search_test.py +2 -2
  164. data/tracks/python/exercises/binary/binary_test.py +2 -2
  165. data/tracks/python/exercises/bob/bob_test.py +4 -2
  166. data/tracks/python/exercises/bob/example.py +5 -2
  167. data/tracks/python/exercises/circular-buffer/circular_buffer_test.py +2 -2
  168. data/tracks/python/exercises/custom-set/README.md +20 -0
  169. data/tracks/python/exercises/custom-set/custom_set.py +30 -0
  170. data/tracks/python/exercises/custom-set/custom_set_test.py +212 -0
  171. data/tracks/python/exercises/custom-set/example.py +45 -0
  172. data/tracks/python/exercises/dot-dsl/dot_dsl_test.py +20 -10
  173. data/tracks/python/exercises/error-handling/error_handling_test.py +2 -2
  174. data/tracks/python/exercises/forth/forth_test.py +18 -18
  175. data/tracks/python/exercises/grains/grains_test.py +2 -2
  176. data/tracks/python/exercises/hamming/hamming_test.py +2 -2
  177. data/tracks/python/exercises/hexadecimal/hexadecimal_test.py +2 -2
  178. data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +2 -2
  179. data/tracks/python/exercises/meetup/meetup_test.py +2 -2
  180. data/tracks/python/exercises/minesweeper/minesweeper_test.py +2 -2
  181. data/tracks/python/exercises/nth-prime/nth_prime_test.py +2 -2
  182. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +2 -2
  183. data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +2 -2
  184. data/tracks/python/exercises/octal/octal_test.py +2 -2
  185. data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +2 -2
  186. data/tracks/python/exercises/phone-number/phone_number_test.py +2 -2
  187. data/tracks/python/exercises/pov/pov_test.py +2 -2
  188. data/tracks/python/exercises/protein-translation/protein_translation_test.py +2 -2
  189. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +2 -2
  190. data/tracks/python/exercises/queen-attack/queen_attack_test.py +2 -2
  191. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +2 -2
  192. data/tracks/python/exercises/saddle-points/saddle_points_test.py +2 -2
  193. data/tracks/python/exercises/say/say_test.py +2 -2
  194. data/tracks/python/exercises/scale-generator/scale_generator_test.py +2 -2
  195. data/tracks/python/exercises/series/series_test.py +2 -2
  196. data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +2 -2
  197. data/tracks/python/exercises/simple-linked-list/simple_linked_list_test.py +2 -2
  198. data/tracks/python/exercises/tree-building/tree_building_test.py +2 -2
  199. data/tracks/python/exercises/triangle/example.py +14 -24
  200. data/tracks/python/exercises/triangle/triangle.py +6 -6
  201. data/tracks/python/exercises/triangle/triangle_test.py +42 -44
  202. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity_test.py +2 -2
  203. data/tracks/python/exercises/wordy/wordy_test.py +2 -2
  204. data/tracks/python/test/check-exercises.py +2 -1
  205. metadata +22 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe25bae56189cb9dd2f98c3dd8a9e08f1de442c7
4
- data.tar.gz: cf7251e1202e956a8c2d8bde50aea6b834f78785
3
+ metadata.gz: 81eca53e081d3529ffccdc505c2470677bcd75fa
4
+ data.tar.gz: 5c658d2fdc47d731a5c12857851e327019bfcf0f
5
5
  SHA512:
6
- metadata.gz: c5bc03f80fd2457525a2bc01b1e225926c1d521c601114892130859c891eb2f3847f2082fe1e741793b1c2af534d3c3b70aea8419e33301fbaa6aa5db503d514
7
- data.tar.gz: 600e433bf221bd210e9bdada5c051c8725fc41e6326b4e14904f72ad043249934c93f485408e1502a01367efb8e2925c9d1df75cecb291d9622a8303d81660b8
6
+ metadata.gz: dcb54de6244b11bc2ac9ade0eee35db7a0436a8fbb1eabcd8f5d6be9e46df5a4d35015df8f3f0c31ffb470b766bce0d0b07fb426566a22de1ca454809860f3a1
7
+ data.tar.gz: b188c9715563d6aa42540f7f85295b58c99841515fdcc8ef9e3322d8887006a8a08ac664bc05bf7a0875d94019e9e8901f46d0a6e4a937283162775204e9fe57
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.95"
2
+ VERSION = "2.2.1.96"
3
3
  end
@@ -1,95 +1,95 @@
1
1
  {
2
2
  "exercise": "two-bucket",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "cases": [
5
5
  {
6
6
  "description": "Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one",
7
7
  "property": "measure",
8
8
  "input": {
9
- "bucket_one": 3,
10
- "bucket_two": 5,
9
+ "bucketOne": 3,
10
+ "bucketTwo": 5,
11
11
  "goal": 1,
12
- "start_bucket": "one"
12
+ "startBucket": "one"
13
13
  },
14
14
  "expected": {
15
15
  "moves": 4,
16
- "goal_bucket": "one",
17
- "other_bucket": 5
16
+ "goalBucket": "one",
17
+ "otherBucket": 5
18
18
  }
19
19
  },
20
20
  {
21
21
  "description": "Measure using bucket one of size 3 and bucket two of size 5 - start with bucket two",
22
22
  "property": "measure",
23
23
  "input": {
24
- "bucket_one": 3,
25
- "bucket_two": 5,
24
+ "bucketOne": 3,
25
+ "bucketTwo": 5,
26
26
  "goal": 1,
27
- "start_bucket": "two"
27
+ "startBucket": "two"
28
28
  },
29
29
  "expected": {
30
30
  "moves": 8,
31
- "goal_bucket": "two",
32
- "other_bucket": 3
31
+ "goalBucket": "two",
32
+ "otherBucket": 3
33
33
  }
34
34
  },
35
35
  {
36
36
  "description": "Measure using bucket one of size 7 and bucket two of size 11 - start with bucket one",
37
37
  "property": "measure",
38
38
  "input": {
39
- "bucket_one": 7,
40
- "bucket_two": 11,
39
+ "bucketOne": 7,
40
+ "bucketTwo": 11,
41
41
  "goal": 2,
42
- "start_bucket": "one"
42
+ "startBucket": "one"
43
43
  },
44
44
  "expected": {
45
45
  "moves": 14,
46
- "goal_bucket": "one",
47
- "other_bucket": 11
46
+ "goalBucket": "one",
47
+ "otherBucket": 11
48
48
  }
49
49
  },
50
50
  {
51
51
  "description": "Measure using bucket one of size 7 and bucket two of size 11 - start with bucket two",
52
52
  "property": "measure",
53
53
  "input": {
54
- "bucket_one": 7,
55
- "bucket_two": 11,
54
+ "bucketOne": 7,
55
+ "bucketTwo": 11,
56
56
  "goal": 2,
57
- "start_bucket": "two"
57
+ "startBucket": "two"
58
58
  },
59
59
  "expected": {
60
60
  "moves": 18,
61
- "goal_bucket": "two",
62
- "other_bucket": 7
61
+ "goalBucket": "two",
62
+ "otherBucket": 7
63
63
  }
64
64
  },
65
65
  {
66
66
  "description": "Measure one step using bucket one of size 1 and bucket two of size 3 - start with bucket two",
67
67
  "property": "measure",
68
68
  "input": {
69
- "bucket_one": 1,
70
- "bucket_two": 3,
69
+ "bucketOne": 1,
70
+ "bucketTwo": 3,
71
71
  "goal": 3,
72
- "start_bucket": "two"
72
+ "startBucket": "two"
73
73
  },
74
74
  "expected": {
75
75
  "moves": 1,
76
- "goal_bucket": "two",
77
- "other_bucket": 0
76
+ "goalBucket": "two",
77
+ "otherBucket": 0
78
78
  }
79
79
  },
80
80
  {
81
81
  "description": "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two",
82
82
  "property": "measure",
83
83
  "input": {
84
- "bucket_one": 2,
85
- "bucket_two": 3,
84
+ "bucketOne": 2,
85
+ "bucketTwo": 3,
86
86
  "goal": 3,
87
- "start_bucket": "one"
87
+ "startBucket": "one"
88
88
  },
89
89
  "expected": {
90
90
  "moves": 2,
91
- "goal_bucket": "two",
92
- "other_bucket": 2
91
+ "goalBucket": "two",
92
+ "otherBucket": 2
93
93
  }
94
94
  }
95
95
  ]
@@ -1,5 +1,23 @@
1
- C# is a modern, object oriented language developed and maintained by Microsoft. The learning curve is small, reduced even if the developer has experience with other 'C-Style' languages.
1
+ C# is a multi-paradigm, statically-typed programming language with object-oriented, declarative, functional, generic, lazy, integrated querying features and type inference.
2
2
 
3
- C# is a carefully designed language with lots of great features, such as type-inference and async/await. The official [documentation](https://docs.microsoft.com/en-us/dotnet/csharp/) is very extensive and well-written.
3
+ __Statically-typed__ means that identifiers have a [type](https://en.wikipedia.org/wiki/Type_system#Static_type_checking) set at compile time--like those in Java, C++ or Haskell--instead of holding data of any type like those in Python, Ruby or JavaScript.
4
4
 
5
- Although .NET used to be Windows-only, with the release of [.NET Core](https://www.microsoft.com/net/core) you can also use C# on Mac or Unix-based systems.
5
+ __Object-oriented__ means that C# provides imperative [class-based objects](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/object-oriented-programming) with features such as single inheritance, interfaces and encapsulation.
6
+
7
+ __Declarative__ means programming [what is to be done](https://stackoverflow.com/questions/1784664/what-is-the-difference-between-declarative-and-imperative-programming), as opposed to how it is done (a.k.a imperative programming) (which is an implementation detail which can distract from the domain or business logic).
8
+
9
+ __Functional__ means that [functions are first-class data types](https://livebook.manning.com/#!/book/functional-programming-in-c-sharp/chapter-1) that can be passed as arguments to and returned from other functions.
10
+
11
+ __Generic__ means that algorithms are written in terms of types [to-be-specified-later](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/generic-type-parameters) that are then instantiated, when needed, for the specific types provided as parameters.
12
+
13
+ __Lazy__ [(a.k.a "deferred execution")](https://blogs.msdn.microsoft.com/pedram/2007/06/02/lazy-evaluation-in-c/) means that the compiler will put off evaluating an item until required. This lets one safely do weird stuff like operating on an infinite list--the language will only create the list up to the last value needed.
14
+
15
+ __Integrated Querying__ means the language feature called [LINQ "Language-Integrated Query"](https://msdn.microsoft.com/en-us/library/bb308959.aspx), which enables lazy querying directly within the language, not only its own objects but, also, external data sources through formats such as XML, JSON, SQL, NoSQL DBs and event streams.
16
+
17
+ __Type inference__ means that the compiler will often figure out the type of an identifier by itself so you don't have to specify it. Scala and F# both do this.
18
+
19
+ __Syntax__ is similar to that of other C-style languages such as C, C++ and Java.
20
+
21
+ __.NET__ is the managed environment within which C# runs, so you get access to the entire .NET ecosystem, including all packages on [nuget.org](http://www.nuget.org). .NET used to be Windows-only but, with the release of [.NET Core](https://www.microsoft.com/net/core) -- as well as [Mono](http://www.mono-project.com/) -- you can also use C# on Mac, Linux or Unix-based systems and on mobile platforms too.
22
+
23
+ C# also has features, amongst others, to make programming with multiple threads/processors, parallelisation, asynchrony, unmanaged code in a managed environment and language interoperability easier. It is developed and maintained by Microsoft, who provides the official [documentation](https://docs.microsoft.com/en-us/dotnet/csharp/).
@@ -3,7 +3,6 @@ language: dart
3
3
  sudo: false
4
4
 
5
5
  dart:
6
- - dev
7
6
  - stable
8
7
 
9
8
  dart_task:
@@ -19,4 +18,4 @@ before_script:
19
18
  script:
20
19
  - bin/fetch-configlet
21
20
  - bin/configlet lint .
22
- - pub run test
21
+ - pub run test test/
@@ -12,7 +12,7 @@ Clone the repo and run `pub get` to download all the dependencies for this proje
12
12
 
13
13
  To run all the tests execute: `pub run test`
14
14
 
15
- To create a new exercise, use the create-exercise executable in the tool directory: `./tool/create_exercise`
15
+ To create a new exercise, use the executable in the tool directory: `dart bin/create_exercise.dart`
16
16
 
17
17
  ## Exercise Tests ##
18
18
 
@@ -42,4 +42,4 @@ We welcome pull requests of all kinds. No contribution is too small.
42
42
 
43
43
  We encourage contributions that provide fixes and improvements to existing exercises. Please note that this track's exercises must conform to the standards determined in the [exercism/problem-specifications](https://github.com/exercism/problem-specifications) repo. Changes to the tests or documentation of a common exercise will often warrant a PR in that repo before it can be incorporated into this track's exercises. If you're unsure, then go ahead and open a GitHub issue, and we'll discuss the change.
44
44
 
45
- Please read our [Contribution guidelines](CONTRIBUTING.md) on how to help this track!
45
+ Please read our [Contribution guidelines](CONTRIBUTING.md) on how to help this track!
@@ -1,6 +1,3 @@
1
- #!/usr/bin/env dart
2
- // vim: set syntax=dart:
3
-
4
1
  import "dart:io";
5
2
  import "dart:async";
6
3
  import "dart:convert";
@@ -11,11 +8,13 @@ import "package:path/path.dart" show dirname;
11
8
  const ME = "create-exercise";
12
9
 
13
10
  final parser = new ArgParser()
14
- ..addSeparator("Usage: $ME <slug> [--spec-path path]")
11
+ ..addSeparator("Usage: $ME [--spec-path path] <slug>")
15
12
  ..addOption("spec-path", help: "The location of the problem-specifications directory.", valueHelp: 'path');
16
13
 
17
14
  /** Helpers */
18
15
  List<String> words(String str) {
16
+ if (str == null) return [''];
17
+
19
18
  return str
20
19
  .toLowerCase()
21
20
  .replaceAll(new RegExp(r"[^a-z0-9]"), " ")
@@ -25,6 +24,8 @@ List<String> words(String str) {
25
24
  }
26
25
 
27
26
  String upperFirst(String str) {
27
+ if (str == null || str.length == 0) return '';
28
+
28
29
  final chars = str.split("");
29
30
  final first = chars.first;
30
31
 
@@ -127,7 +128,7 @@ String testCaseTemplate(String name, Map<String, Object> testCase, {bool firstTe
127
128
  /// Based on the python `repr` function, but only works for basic types: String, Iterable, Map, and primitive types
128
129
  String repr(Object x) {
129
130
  if (x is String) {
130
- x = x.replaceAll('"', r'\"').replaceAll("\n", r"\n").replaceAll(r"$", r"\$");
131
+ x = (x as String).replaceAll('"', r'\"').replaceAll("\n", r"\n").replaceAll(r"$", r"\$");
131
132
  return '"$x"';
132
133
  }
133
134
 
@@ -148,7 +149,7 @@ String repr(Object x) {
148
149
  }
149
150
 
150
151
  /// A helper method to get the inside type of an iterable
151
- String getIterableType(Object iter) {
152
+ String getIterableType(Iterable iter) {
152
153
  Set<String> types = iter.map(getFriendlyType).toSet();
153
154
 
154
155
  if (types.length == 1) {
@@ -176,7 +177,7 @@ String getFriendlyType(Object x) {
176
177
  return "num";
177
178
  }
178
179
 
179
- return x.runtimeType;
180
+ return x.runtimeType.toString();
180
181
  }
181
182
 
182
183
  // runProcess runs a process, writes any stdout/stderr output.
@@ -217,6 +218,7 @@ Future main(args) async {
217
218
  File file = new File(filename);
218
219
  final specification = JSON.decode(await file.readAsString());
219
220
  testCasesString = testCaseTemplate(name, specification);
221
+ print("Found: ${arguments['spec-path']}/exercises/$name/canonical-data.json");
220
222
  } on FileSystemException {
221
223
  stderr.write("Could not open file '$filename', exiting.\n");
222
224
  exit(1);
@@ -224,6 +226,8 @@ Future main(args) async {
224
226
  stderr.write("File '$filename' is not valid JSON, exiting.\n");
225
227
  exit(1);
226
228
  }
229
+ } else {
230
+ print("Could not find: ${arguments['spec-path']}/exercises/$name/canonical-data.json");
227
231
  }
228
232
 
229
233
  if (await exerciseDir.exists()) {
@@ -257,10 +261,10 @@ Future main(args) async {
257
261
  // The output from file generation is not always well-formatted, use dartfmt to clean it up
258
262
  final fmtSuccess = await runProcess("dartfmt", ["-l", "120", "-w", exerciseDir.path]);
259
263
  if (fmtSuccess) {
260
- stdout.write("Successfully created a rough-draft of tests at '$testFileName'.\n");
261
- stdout.write("You should check this over and fix or refine as necessary.\n");
264
+ stdout.write("Successfully created a rough-draft of tests at '$testFileName'.\n");
265
+ stdout.write("You should check this over and fix or refine as necessary.\n");
262
266
  } else {
263
- stderr.write("Warning: dartfmt exited with an error, files in '${exerciseDir.path}' may be malformed.\n");
267
+ stderr.write("Warning: dartfmt exited with an error, files in '${exerciseDir.path}' may be malformed.\n");
264
268
  }
265
269
 
266
270
  // Install deps
@@ -0,0 +1,132 @@
1
+ import 'package:test/test.dart';
2
+ import '../bin/create_exercise.dart';
3
+
4
+ void main() {
5
+ group('create-exercise tool', () {
6
+ group('helpers', () {
7
+ group('words', () {
8
+ test('null returns empty list', () {
9
+ expect(words(null), equals(['']));
10
+ });
11
+
12
+ test('empty string returns empty list', () {
13
+ expect(words(''), equals(['']));
14
+ });
15
+
16
+ test('single word returns list with single element', () {
17
+ expect(words('foobar'), equals(['foobar']));
18
+ });
19
+
20
+ test('upper case characters are converted to lower case', () {
21
+ expect(words('FOOBAR'), equals(['foobar']));
22
+ });
23
+
24
+ test('words separated by a space become individual list elements', () {
25
+ expect(words('foo bar'), equals(['foo', 'bar']));
26
+ });
27
+
28
+ test('all symbols are replaced by a space', () {
29
+ expect(words('foo@bar'), equals(['foo', 'bar']));
30
+ });
31
+
32
+ test('words can only contain letters and digits', () {
33
+ expect(words('foo bar...123'), equals(['foo', 'bar', '123']));
34
+ });
35
+
36
+ test('multiple occurrences of spaces are trimmed', () {
37
+ expect(words(' foo bar '), equals(['foo', 'bar']));
38
+ });
39
+
40
+ test('all symbols are discarded', () {
41
+ expect(words('<foobar>'), equals(['foobar']));
42
+ });
43
+ });
44
+
45
+ group('upperFirst()', () {
46
+ test('null returns empty string', () {
47
+ expect(upperFirst(null), equals(''));
48
+ });
49
+
50
+ test('empty string returns empty string', () {
51
+ expect(upperFirst(''), equals(''));
52
+ });
53
+
54
+ test('a single lower case character is converted to upper case', () {
55
+ expect(upperFirst('a'), equals('A'));
56
+ });
57
+
58
+ test('a single upper case character remains upper case', () {
59
+ expect(upperFirst('A'), equals('A'));
60
+ });
61
+
62
+ test('a digit remains the same', () {
63
+ expect(upperFirst('0'), equals('0'));
64
+ });
65
+
66
+ test('a symbol remains the same', () {
67
+ expect(upperFirst('?'), equals('?'));
68
+ });
69
+
70
+ test('a lower case string returns the same string capitalized', () {
71
+ expect(upperFirst('foobar'), equals('Foobar'));
72
+ });
73
+
74
+ test('a capitalized string remains the same', () {
75
+ expect(upperFirst('Foobar'), equals('Foobar'));
76
+ });
77
+
78
+ test('only the first word in a string is capitalized', () {
79
+ expect(upperFirst('foo bar'), equals('Foo bar'));
80
+ });
81
+ });
82
+
83
+ group('camelCase()', () {
84
+ test('a lower case string remains the same', () {
85
+ expect(camelCase('foobar'), equals('foobar'));
86
+ });
87
+
88
+ test('returns capitalized string if isUpperFirst is true', () {
89
+ expect(camelCase('foobar', isUpperFirst: true), equals('Foobar'));
90
+ });
91
+
92
+ test('every word after the first is capitalized', () {
93
+ expect(camelCase('foo bar'), equals('fooBar'));
94
+ });
95
+
96
+ test('every word is capitalized if isUpperFirst is true', () {
97
+ expect(camelCase('foo bar', isUpperFirst: true), equals('FooBar'));
98
+ });
99
+ });
100
+
101
+ group('pascalCase()', () {
102
+ test('the first character is converted to upper case', () {
103
+ expect(pascalCase('foobar'), equals('Foobar'));
104
+ });
105
+
106
+ test('every word is capitalized', () {
107
+ expect(pascalCase('foo bar'), equals('FooBar'));
108
+ });
109
+ });
110
+
111
+ group('snakeCase()', () {
112
+ test('every word is separated by an underscore', () {
113
+ expect(snakeCase('foo bar'), equals('foo_bar'));
114
+ });
115
+
116
+ test('symbols are replaced by an underscore', () {
117
+ expect(snakeCase('foo-bar'), equals('foo_bar'));
118
+ });
119
+ });
120
+
121
+ group('kebabCase()', () {
122
+ test('every word is separated by a dash', () {
123
+ expect(kebabCase('foo bar'), equals('foo-bar'));
124
+ });
125
+
126
+ test('symbols are replaced by a dash', () {
127
+ expect(kebabCase('foo_bar'), equals('foo-bar'));
128
+ });
129
+ });
130
+ });
131
+ });
132
+ }
@@ -1,4 +1,4 @@
1
- @Timeout(const Duration(seconds: 45))
1
+ @Timeout(const Duration(seconds: 60))
2
2
 
3
3
  import "dart:io";
4
4
  import "dart:async";
@@ -5,7 +5,7 @@ let rec foldl folder state list =
5
5
  | [] -> state
6
6
  | x::xs -> foldl folder (folder state x) xs
7
7
 
8
- let rec foldr folder list state =
8
+ let rec foldr folder state list =
9
9
  list
10
10
  |> List.rev
11
11
  |> foldl (fun acc item -> folder item acc) state
@@ -14,10 +14,10 @@ let length list = foldl (fun acc _ -> acc + 1) 0 list
14
14
 
15
15
  let reverse list = foldl (fun acc item -> item :: acc) [] list
16
16
 
17
- let map f list = foldr (fun item acc -> f item :: acc) list []
17
+ let map f list = foldr (fun item acc -> f item :: acc) [] list
18
18
 
19
- let filter f list = foldr (fun item acc -> if f item then item :: acc else acc) list []
19
+ let filter f list = foldr (fun item acc -> if f item then item :: acc else acc) [] list
20
20
 
21
- let append xs ys = foldr (fun item acc -> item :: acc) xs ys
21
+ let append xs ys = foldr (fun item acc -> item :: acc) ys xs
22
22
 
23
- let concat xs = foldr append xs []
23
+ let concat xs = foldr append [] xs