trackler 2.2.1.71 → 2.2.1.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/book-store/canonical-data.json +9 -2
  4. data/problem-specifications/exercises/word-count/canonical-data.json +9 -0
  5. data/tracks/bash/CONTRIBUTING.md +199 -0
  6. data/tracks/bash/config.json +24 -11
  7. data/tracks/bash/exercises/triangle/README.md +38 -0
  8. data/tracks/bash/exercises/triangle/example.sh +56 -0
  9. data/tracks/bash/exercises/triangle/triangle_test.sh +126 -0
  10. data/tracks/bash/img/canonical-data-example.png +0 -0
  11. data/tracks/bash/img/create-pr.png +0 -0
  12. data/tracks/bash/img/fork-repository.png +0 -0
  13. data/tracks/c/exercises/acronym/makefile +1 -1
  14. data/tracks/c/exercises/all-your-base/makefile +1 -1
  15. data/tracks/c/exercises/allergies/makefile +1 -1
  16. data/tracks/c/exercises/anagram/makefile +1 -1
  17. data/tracks/c/exercises/atbash-cipher/makefile +1 -1
  18. data/tracks/c/exercises/beer-song/makefile +1 -1
  19. data/tracks/c/exercises/binary-search/makefile +1 -1
  20. data/tracks/c/exercises/binary/makefile +1 -1
  21. data/tracks/c/exercises/bob/makefile +1 -1
  22. data/tracks/c/exercises/clock/makefile +1 -1
  23. data/tracks/c/exercises/collatz-conjecture/makefile +1 -1
  24. data/tracks/c/exercises/difference-of-squares/makefile +1 -1
  25. data/tracks/c/exercises/gigasecond/makefile +1 -1
  26. data/tracks/c/exercises/grains/makefile +1 -1
  27. data/tracks/c/exercises/hamming/makefile +1 -1
  28. data/tracks/c/exercises/hamming/test/test_hamming.c +2 -2
  29. data/tracks/c/exercises/hello-world/makefile +1 -1
  30. data/tracks/c/exercises/isogram/makefile +1 -1
  31. data/tracks/c/exercises/largest-series-product/makefile +1 -1
  32. data/tracks/c/exercises/leap/makefile +1 -1
  33. data/tracks/c/exercises/meetup/makefile +1 -1
  34. data/tracks/c/exercises/nth-prime/makefile +1 -1
  35. data/tracks/c/exercises/nucleotide-count/makefile +1 -1
  36. data/tracks/c/exercises/palindrome-products/makefile +1 -1
  37. data/tracks/c/exercises/pangram/makefile +1 -1
  38. data/tracks/c/exercises/pascals-triangle/makefile +1 -1
  39. data/tracks/c/exercises/perfect-numbers/makefile +1 -1
  40. data/tracks/c/exercises/phone-number/makefile +1 -1
  41. data/tracks/c/exercises/queen-attack/makefile +1 -1
  42. data/tracks/c/exercises/raindrops/makefile +1 -1
  43. data/tracks/c/exercises/react/makefile +1 -1
  44. data/tracks/c/exercises/rna-transcription/makefile +1 -1
  45. data/tracks/c/exercises/robot-simulator/makefile +1 -1
  46. data/tracks/c/exercises/roman-numerals/makefile +1 -1
  47. data/tracks/c/exercises/scrabble-score/makefile +1 -1
  48. data/tracks/c/exercises/series/makefile +1 -1
  49. data/tracks/c/exercises/sieve/makefile +1 -1
  50. data/tracks/c/exercises/space-age/makefile +1 -1
  51. data/tracks/c/exercises/sublist/makefile +1 -1
  52. data/tracks/c/exercises/sum-of-multiples/makefile +1 -1
  53. data/tracks/c/exercises/triangle/makefile +1 -1
  54. data/tracks/c/exercises/word-count/makefile +1 -1
  55. data/tracks/delphi/exercises/allergies/README.md +1 -1
  56. data/tracks/delphi/exercises/bank-account/README.md +1 -1
  57. data/tracks/delphi/exercises/beer-song/README.md +1 -1
  58. data/tracks/delphi/exercises/binary-search/README.md +1 -1
  59. data/tracks/delphi/exercises/bob/README.md +1 -1
  60. data/tracks/delphi/exercises/book-store/README.md +1 -1
  61. data/tracks/delphi/exercises/book-store/uBookStoreExample.pas +34 -14
  62. data/tracks/delphi/exercises/book-store/uBookStoreTests.pas +36 -1
  63. data/tracks/delphi/exercises/bowling/README.md +1 -1
  64. data/tracks/delphi/exercises/circular-buffer/README.md +1 -1
  65. data/tracks/delphi/exercises/clock/README.md +1 -1
  66. data/tracks/delphi/exercises/collatz-conjecture/README.md +1 -1
  67. data/tracks/delphi/exercises/etl/README.md +1 -1
  68. data/tracks/delphi/exercises/grains/README.md +1 -1
  69. data/tracks/delphi/exercises/hamming/README.md +1 -1
  70. data/tracks/delphi/exercises/hello-world/README.md +1 -1
  71. data/tracks/delphi/exercises/leap/README.md +1 -1
  72. data/tracks/delphi/exercises/minesweeper/README.md +1 -1
  73. data/tracks/delphi/exercises/nucleotide-count/README.md +1 -1
  74. data/tracks/delphi/exercises/perfect-numbers/README.md +1 -1
  75. data/tracks/delphi/exercises/phone-number/README.md +1 -1
  76. data/tracks/delphi/exercises/pig-latin/README.md +1 -1
  77. data/tracks/delphi/exercises/poker/README.md +1 -1
  78. data/tracks/delphi/exercises/raindrops/README.md +1 -1
  79. data/tracks/delphi/exercises/reverse-string/README.md +1 -1
  80. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  81. data/tracks/delphi/exercises/roman-numerals/README.md +1 -1
  82. data/tracks/delphi/exercises/saddle-points/README.md +1 -1
  83. data/tracks/delphi/exercises/triangle/README.md +1 -1
  84. data/tracks/delphi/exercises/two-fer/README.md +1 -1
  85. data/tracks/delphi/exercises/wordy/README.md +1 -1
  86. data/tracks/ecmascript/.travis.yml +1 -1
  87. data/tracks/ecmascript/Makefile +4 -5
  88. data/tracks/ecmascript/README.md +2 -1
  89. data/tracks/ecmascript/config.json +12 -0
  90. data/tracks/ecmascript/exercises/change/package.json +5 -3
  91. data/tracks/ecmascript/exercises/protein-translation/package.json +2 -2
  92. data/tracks/ecmascript/exercises/react/README.md +41 -0
  93. data/tracks/ecmascript/exercises/react/example.js +101 -0
  94. data/tracks/ecmascript/exercises/react/package.json +71 -0
  95. data/tracks/ecmascript/exercises/react/react.spec.js +211 -0
  96. data/tracks/ecmascript/exercises/rectangles/package.json +1 -2
  97. data/tracks/ecmascript/exercises/rotational-cipher/package.json +1 -2
  98. data/tracks/ecmascript/exercises/spiral-matrix/package.json +1 -2
  99. data/tracks/ecmascript/exercises/transpose/package.json +2 -2
  100. data/tracks/erlang/docs/ABOUT.md +1 -1
  101. data/tracks/go/exercises/binary-search/.meta/gen.go +55 -0
  102. data/tracks/go/exercises/binary-search/binary_search_test.go +26 -167
  103. data/tracks/go/exercises/binary-search/cases_test.go +73 -0
  104. data/tracks/go/exercises/binary-search/example.go +8 -30
  105. data/tracks/go/exercises/nth-prime/.meta/gen.go +76 -0
  106. data/tracks/go/exercises/nth-prime/cases_test.go +43 -0
  107. data/tracks/go/exercises/nth-prime/nth_prime_test.go +4 -18
  108. data/tracks/go/exercises/prime-factors/.meta/gen.go +54 -0
  109. data/tracks/go/exercises/prime-factors/cases_test.go +48 -0
  110. data/tracks/go/exercises/prime-factors/prime_factors_test.go +4 -19
  111. data/tracks/groovy/config.json +13 -1
  112. data/tracks/groovy/exercises/linked-list/DoubleLinkedList.groovy +19 -0
  113. data/tracks/groovy/exercises/linked-list/DoubleLinkedListSpec.groovy +79 -0
  114. data/tracks/groovy/exercises/linked-list/Example.groovy +57 -0
  115. data/tracks/groovy/exercises/linked-list/README.md +49 -0
  116. data/tracks/java/bin/run-journey-test-from-ci.sh +1 -1
  117. data/tracks/java/config.json +10 -0
  118. data/tracks/java/config/maintainers.json +8 -1
  119. data/tracks/java/docs/MAINTAINING.md +3 -3
  120. data/tracks/java/exercises/accumulate/.meta/src/reference/java/Accumulate.java +2 -2
  121. data/tracks/java/exercises/binary/.meta/src/reference/java/Binary.java +3 -3
  122. data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/BufferIOException.java +1 -1
  123. data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/CircularBuffer.java +6 -6
  124. data/tracks/java/exercises/circular-buffer/src/main/java/BufferIOException.java +1 -1
  125. data/tracks/java/exercises/clock/.meta/src/reference/java/Clock.java +3 -3
  126. data/tracks/java/exercises/crypto-square/.meta/src/reference/java/Crypto.java +7 -7
  127. data/tracks/java/exercises/etl/.meta/src/reference/java/Etl.java +2 -2
  128. data/tracks/java/exercises/etl/src/main/java/Etl.java +2 -2
  129. data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/KindergartenGarden.java +4 -4
  130. data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/Plant.java +2 -2
  131. data/tracks/java/exercises/kindergarten-garden/src/main/java/Plant.java +2 -2
  132. data/tracks/java/exercises/nth-prime/.meta/src/reference/java/PrimeCalculator.java +2 -2
  133. data/tracks/java/exercises/reverse-string/.meta/src/reference/java/ReverseString.java +7 -0
  134. data/tracks/java/exercises/reverse-string/.meta/version +1 -0
  135. data/tracks/java/exercises/reverse-string/README.md +25 -0
  136. data/tracks/java/exercises/reverse-string/build.gradle +17 -0
  137. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +7 -0
  138. data/tracks/java/exercises/reverse-string/src/test/java/ReverseStringTest.java +37 -0
  139. data/tracks/java/exercises/run-length-encoding/.meta/src/reference/java/RunLengthEncoding.java +4 -4
  140. data/tracks/java/exercises/settings.gradle +1 -0
  141. data/tracks/kotlin/docs/RESOURCES.md +1 -1
  142. data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
  143. data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
  144. data/tracks/kotlin/exercises/all-your-base/build.gradle +1 -1
  145. data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
  146. data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
  147. data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
  148. data/tracks/kotlin/exercises/bank-account/build.gradle +1 -1
  149. data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
  150. data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
  151. data/tracks/kotlin/exercises/binary/build.gradle +1 -1
  152. data/tracks/kotlin/exercises/bob/build.gradle +1 -1
  153. data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
  154. data/tracks/kotlin/exercises/change/build.gradle +1 -1
  155. data/tracks/kotlin/exercises/clock/build.gradle +1 -1
  156. data/tracks/kotlin/exercises/collatz-conjecture/build.gradle +1 -1
  157. data/tracks/kotlin/exercises/complex-numbers/build.gradle +1 -1
  158. data/tracks/kotlin/exercises/diamond/build.gradle +1 -1
  159. data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
  160. data/tracks/kotlin/exercises/etl/build.gradle +1 -1
  161. data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
  162. data/tracks/kotlin/exercises/forth/build.gradle +1 -1
  163. data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
  164. data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
  165. data/tracks/kotlin/exercises/grains/build.gradle +1 -1
  166. data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
  167. data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
  168. data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
  169. data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
  170. data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
  171. data/tracks/kotlin/exercises/leap/build.gradle +1 -1
  172. data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
  173. data/tracks/kotlin/exercises/list-ops/build.gradle +1 -1
  174. data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
  175. data/tracks/kotlin/exercises/meetup/build.gradle +1 -1
  176. data/tracks/kotlin/exercises/minesweeper/build.gradle +1 -1
  177. data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
  178. data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
  179. data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
  180. data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
  181. data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
  182. data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
  183. data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
  184. data/tracks/kotlin/exercises/prime-factors/build.gradle +1 -1
  185. data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
  186. data/tracks/kotlin/exercises/react/build.gradle +1 -1
  187. data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
  188. data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
  189. data/tracks/kotlin/exercises/robot-simulator/build.gradle +1 -1
  190. data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
  191. data/tracks/kotlin/exercises/rotational-cipher/build.gradle +1 -1
  192. data/tracks/kotlin/exercises/saddle-points/build.gradle +1 -1
  193. data/tracks/kotlin/exercises/say/build.gradle +1 -1
  194. data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
  195. data/tracks/kotlin/exercises/secret-handshake/build.gradle +1 -1
  196. data/tracks/kotlin/exercises/series/build.gradle +1 -1
  197. data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
  198. data/tracks/kotlin/exercises/simple-cipher/README.md +4 -6
  199. data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
  200. data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
  201. data/tracks/kotlin/exercises/spiral-matrix/build.gradle +1 -1
  202. data/tracks/kotlin/exercises/strain/build.gradle +1 -1
  203. data/tracks/kotlin/exercises/sublist/build.gradle +1 -1
  204. data/tracks/kotlin/exercises/sum-of-multiples/build.gradle +1 -1
  205. data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
  206. data/tracks/kotlin/exercises/two-fer/build.gradle +1 -1
  207. data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
  208. data/tracks/lua/.gitignore +1 -0
  209. data/tracks/lua/config.json +12 -0
  210. data/tracks/lua/exercises/isbn-verifier/README.md +52 -0
  211. data/tracks/lua/exercises/isbn-verifier/example.lua +16 -0
  212. data/tracks/lua/exercises/isbn-verifier/isbn-verifier_spec.lua +55 -0
  213. data/tracks/ocaml/.travis-ci.sh +1 -1
  214. data/tracks/ocaml/.travis.yml +1 -1
  215. data/tracks/ocaml/README.md +1 -1
  216. data/tracks/perl6/config.json +10 -0
  217. data/tracks/perl6/exercises/acronym/Acronym.pm6 +4 -0
  218. data/tracks/perl6/exercises/acronym/Example.pm6 +5 -0
  219. data/tracks/perl6/exercises/acronym/README.md +33 -0
  220. data/tracks/perl6/exercises/acronym/acronym.t +96 -0
  221. data/tracks/perl6/exercises/acronym/example.yaml +19 -0
  222. data/tracks/perl6/exercises/word-count/Example.pm6 +1 -1
  223. data/tracks/perl6/exercises/word-count/WordCount.pm6 +1 -1
  224. data/tracks/perl6/exercises/word-count/example.yaml +2 -2
  225. data/tracks/perl6/exercises/word-count/word-count.t +11 -2
  226. data/tracks/pony/docs/RESOURCES.md +1 -1
  227. data/tracks/purescript/docs/INSTALLATION.md +1 -3
  228. data/tracks/python/config.json +1 -1
  229. data/tracks/r/exercises/word-count/test_word-count.R +5 -0
  230. data/tracks/ruby/README.md +73 -10
  231. data/tracks/rust/config.json +34 -0
  232. data/tracks/rust/exercises/book-store/Cargo.toml +1 -1
  233. data/tracks/rust/exercises/book-store/tests/book-store.rs +7 -0
  234. data/tracks/rust/exercises/diffie-hellman/.gitignore +9 -0
  235. data/tracks/rust/exercises/diffie-hellman/Cargo-example.toml +6 -0
  236. data/tracks/rust/exercises/diffie-hellman/Cargo.toml +5 -0
  237. data/tracks/rust/exercises/diffie-hellman/README.md +77 -0
  238. data/tracks/rust/exercises/diffie-hellman/example.rs +15 -0
  239. data/tracks/rust/exercises/diffie-hellman/src/lib.rs +11 -0
  240. data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +60 -0
  241. data/tracks/rust/exercises/macros/.gitignore +3 -0
  242. data/tracks/rust/exercises/macros/.meta/description.md +29 -0
  243. data/tracks/rust/exercises/macros/.meta/metadata.yml +3 -0
  244. data/tracks/rust/exercises/macros/Cargo.toml +6 -0
  245. data/tracks/rust/exercises/macros/README.md +70 -0
  246. data/tracks/rust/exercises/macros/example.rs +16 -0
  247. data/tracks/rust/exercises/macros/src/lib.rs +6 -0
  248. data/tracks/rust/exercises/macros/tests/macros.rs +62 -0
  249. data/tracks/rust/exercises/simple-linked-list/.gitignore +7 -0
  250. data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +34 -0
  251. data/tracks/rust/exercises/simple-linked-list/Cargo.toml +5 -0
  252. data/tracks/rust/exercises/simple-linked-list/README.md +96 -0
  253. data/tracks/rust/exercises/simple-linked-list/example.rs +87 -0
  254. data/tracks/rust/exercises/simple-linked-list/src/lib.rs +46 -0
  255. data/tracks/rust/exercises/simple-linked-list/tests/simple-linked-list.rs +91 -0
  256. data/tracks/swift/.travis.yml +1 -1
  257. data/tracks/swift/config.json +24 -0
  258. data/tracks/swift/exercises/isbn-verifier/Package.swift +5 -0
  259. data/tracks/swift/exercises/isbn-verifier/README.md +39 -0
  260. data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifier.swift +1 -0
  261. data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifierExample.swift +35 -0
  262. data/tracks/swift/exercises/isbn-verifier/Tests/IsbnVerifierTests/IsbnVerifierTests.swift +75 -0
  263. data/tracks/swift/exercises/isbn-verifier/Tests/LinuxMain.swift +6 -0
  264. data/tracks/swift/exercises/two-fer/Package.swift +5 -0
  265. data/tracks/swift/exercises/two-fer/README.md +54 -0
  266. data/tracks/swift/exercises/two-fer/Sources/TwoFer.swift +1 -0
  267. data/tracks/swift/exercises/two-fer/Sources/TwoFerExample.swift +6 -0
  268. data/tracks/swift/exercises/two-fer/Tests/LinuxMain.swift +6 -0
  269. data/tracks/swift/exercises/two-fer/Tests/TwoFerTests/TwoFerTests.swift +25 -0
  270. metadata +71 -2
@@ -37,7 +37,7 @@ A binary search is a dichotomic divide and conquer search algorithm.
37
37
  ## Testing
38
38
 
39
39
  In order to run the tests for this track, you will need to install
40
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
40
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
41
41
 
42
42
  ### Loading Exercises into Delphi
43
43
 
@@ -14,7 +14,7 @@ He answers 'Whatever.' to anything else.
14
14
  ## Testing
15
15
 
16
16
  In order to run the tests for this track, you will need to install
17
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
17
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
18
18
 
19
19
  ### Loading Exercises into Delphi
20
20
 
@@ -70,7 +70,7 @@ And $51.20 is the price with the biggest discount.
70
70
  ## Testing
71
71
 
72
72
  In order to run the tests for this track, you will need to install
73
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
73
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
74
74
 
75
75
  ### Loading Exercises into Delphi
76
76
 
@@ -11,7 +11,7 @@ type
11
11
  function NewBasket(aBasket: TArray<Integer>): IBasket;
12
12
 
13
13
  implementation
14
- uses System.SysUtils;
14
+ uses System.SysUtils, System.Generics.collections, System.Math;
15
15
 
16
16
  const
17
17
  seriesBooks = '12345';
@@ -27,6 +27,7 @@ type
27
27
  private
28
28
  fSingleBookPrice: extended;
29
29
  fBasket: string;
30
+ fIntList: TList<integer>;
30
31
  class function Head(inStr: string): string; static;
31
32
  class function Tail(inStr: string): string; static;
32
33
  class function ConvertIntArrayToString(const aIntArray: TArray<Integer>): string; static;
@@ -65,6 +66,9 @@ end;
65
66
  constructor TBasket.Create(aBasket: TArray<Integer>);
66
67
  begin
67
68
  fSingleBookPrice := 8;
69
+ fIntList := TList<integer>.Create;
70
+ fIntList.AddRange(aBasket);
71
+ fIntList.Sort;
68
72
  fBasket := ConvertIntArrayToString(aBasket);
69
73
  end;
70
74
 
@@ -108,26 +112,42 @@ begin
108
112
  end;
109
113
 
110
114
  function TBasket.Total:extended;
111
- var hpBook : char;
112
- totalBooks : integer;
113
- subBaskets : TArray<String>;
114
- wrkSubBasket: string;
115
- subTotal : extended;
115
+ var
116
+ subBaskets : TArray<String>;
117
+ subResult : array[0..1] of extended;
118
+ lSortedBasket : TArray<integer>;
119
+
120
+ function computeTotal: extended;
121
+ var wrkSubBasket: string;
122
+ totalBooks : integer;
123
+ subTotal : extended;
124
+ begin
125
+ result := 0;
126
+ for wrkSubBasket in subBaskets do
127
+ begin
128
+ totalBooks := wrkSubBasket.Length;
129
+ subTotal := totalBooks * (fSingleBookPrice * DiscountPercentage(wrkSubBasket));
130
+ Result := Result + subTotal;
131
+ end;
132
+ end;
133
+
116
134
  begin
135
+ fillchar(subResult, sizeof(extended), #0);
136
+
117
137
  subBaskets := GroupBasket;
118
- result := 0;
119
- for wrkSubBasket in subBaskets do
120
- begin
121
- totalBooks := wrkSubBasket.Length;
122
- subTotal := totalBooks * (fSingleBookPrice * DiscountPercentage(wrkSubBasket));
123
- result := result + subTotal;
124
- end;
138
+ subResult[0] := computeTotal;
139
+
140
+ lSortedBasket := fIntList.ToArray;
141
+ fBasket := ConvertIntArrayToString(lSortedBasket);
142
+ subBaskets := GroupBasket;
143
+ subResult[1] := computeTotal;
144
+
145
+ result := min(subResult[0], subResult[1]);
125
146
  end;
126
147
 
127
148
  function TBasket.DiscountPercentage(inStr : string):extended;
128
149
  var numDiffBooks: integer;
129
150
  begin
130
- result := 1;
131
151
  numDiffBooks := NumberOfDifferentBooks(inStr);
132
152
  result := CDiscounts[numDiffBooks];
133
153
  end;
@@ -4,12 +4,15 @@ interface
4
4
  uses
5
5
  DUnitX.TestFramework;
6
6
 
7
+ const
8
+ CanonicalVersion = '1.1.0';
9
+
7
10
  type
8
11
  [TestFixture]
9
12
  hpTests = class(TObject)
10
13
  public
11
14
  [Test]
12
- // [Ignore('Comment the "[Ignore]" statement to run the test')]
15
+ // [Ignore('Comment the "[Ignore]" statement to run the test')]
13
16
  procedure A_basket_containing_only_a_single_book;
14
17
 
15
18
  [Test]
@@ -55,6 +58,10 @@ type
55
58
  [Test]
56
59
  [Ignore]
57
60
  procedure A_basket_containing_twelve_books_consisting_of_three_copies_of_the_first_two_books_plus_two_each_of_the_remaining_three_books_in_the_series;
61
+
62
+ [Test]
63
+ [Ignore]
64
+ procedure Four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three;
58
65
  end;
59
66
 
60
67
  implementation
@@ -130,6 +137,34 @@ begin
130
137
  assert.AreEqual(Expected, fBasket.Total, MinDelta, format('Total should be %0.2f',[Expected]));
131
138
  end;
132
139
 
140
+ procedure hpTests.Four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three;
141
+ var Basket: TArray<integer>;
142
+ fBasket: IBasket;
143
+ Expected: double;
144
+ begin
145
+ SetLength(Basket, 16);
146
+ Basket[0] := 1;
147
+ Basket[1] := 1;
148
+ Basket[2] := 2;
149
+ Basket[3] := 2;
150
+ Basket[4] := 3;
151
+ Basket[5] := 3;
152
+ Basket[6] := 4;
153
+ Basket[7] := 5;
154
+ Basket[8] := 1;
155
+ Basket[9] := 1;
156
+ Basket[10] := 2;
157
+ Basket[11] := 2;
158
+ Basket[12] := 3;
159
+ Basket[13] := 3;
160
+ Basket[14] := 4;
161
+ Basket[15] := 5;
162
+ Expected := 102.40;
163
+
164
+ fBasket := NewBasket(Basket);
165
+ assert.AreEqual(Expected, fBasket.Total, MinDelta, format('Total should be %0.2f',[Expected]));
166
+ end;
167
+
133
168
  procedure hpTests.A_basket_with_four_different_books;
134
169
  var Basket: TArray<integer>;
135
170
  fBasket: IBasket;
@@ -63,7 +63,7 @@ support two operations:
63
63
  ## Testing
64
64
 
65
65
  In order to run the tests for this track, you will need to install
66
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
66
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
67
67
 
68
68
  ### Loading Exercises into Delphi
69
69
 
@@ -53,7 +53,7 @@ the buffer is once again full.
53
53
  ## Testing
54
54
 
55
55
  In order to run the tests for this track, you will need to install
56
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
56
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
57
57
 
58
58
  ### Loading Exercises into Delphi
59
59
 
@@ -9,7 +9,7 @@ Two clocks that represent the same time should be equal to each other.
9
9
  ## Testing
10
10
 
11
11
  In order to run the tests for this track, you will need to install
12
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
12
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
13
13
 
14
14
  ### Loading Exercises into Delphi
15
15
 
@@ -29,7 +29,7 @@ Resulting in 9 steps. So for input n = 12, the return value would be 9.
29
29
  ## Testing
30
30
 
31
31
  In order to run the tests for this track, you will need to install
32
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
32
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
33
33
 
34
34
  ### Loading Exercises into Delphi
35
35
 
@@ -49,7 +49,7 @@ game while being scored at 4 in the Hawaiian-language version.
49
49
  ## Testing
50
50
 
51
51
  In order to run the tests for this track, you will need to install
52
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
52
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
53
53
 
54
54
  ### Loading Exercises into Delphi
55
55
 
@@ -29,7 +29,7 @@ experiment make the code better? Worse? Did you learn anything from it?
29
29
  ## Testing
30
30
 
31
31
  In order to run the tests for this track, you will need to install
32
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
32
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
33
33
 
34
34
  ### Loading Exercises into Delphi
35
35
 
@@ -38,7 +38,7 @@ of equal length differently.
38
38
  ## Testing
39
39
 
40
40
  In order to run the tests for this track, you will need to install
41
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
41
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
42
42
 
43
43
  ### Loading Exercises into Delphi
44
44
 
@@ -17,7 +17,7 @@ If everything goes well, you will be ready to fetch your first real exercise.
17
17
  ## Testing
18
18
 
19
19
  In order to run the tests for this track, you will need to install
20
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
20
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
21
21
 
22
22
  ### Loading Exercises into Delphi
23
23
 
@@ -29,7 +29,7 @@ phenomenon, go watch [this youtube video][video].
29
29
  ## Testing
30
30
 
31
31
  In order to run the tests for this track, you will need to install
32
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
32
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
33
33
 
34
34
  ### Loading Exercises into Delphi
35
35
 
@@ -29,7 +29,7 @@ into this:
29
29
  ## Testing
30
30
 
31
31
  In order to run the tests for this track, you will need to install
32
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
32
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
33
33
 
34
34
  ### Loading Exercises into Delphi
35
35
 
@@ -15,7 +15,7 @@ Here is an analogy:
15
15
  ## Testing
16
16
 
17
17
  In order to run the tests for this track, you will need to install
18
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
18
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
19
19
 
20
20
  ### Loading Exercises into Delphi
21
21
 
@@ -20,7 +20,7 @@ Implement a way to determine whether a given number is **perfect**. Depending on
20
20
  ## Testing
21
21
 
22
22
  In order to run the tests for this track, you will need to install
23
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
23
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
24
24
 
25
25
  ### Loading Exercises into Delphi
26
26
 
@@ -31,7 +31,7 @@ should all produce the output
31
31
  ## Testing
32
32
 
33
33
  In order to run the tests for this track, you will need to install
34
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
34
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
35
35
 
36
36
  ### Loading Exercises into Delphi
37
37
 
@@ -20,7 +20,7 @@ See <http://en.wikipedia.org/wiki/Pig_latin> for more details.
20
20
  ## Testing
21
21
 
22
22
  In order to run the tests for this track, you will need to install
23
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
23
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
24
24
 
25
25
  ### Loading Exercises into Delphi
26
26
 
@@ -8,7 +8,7 @@ overview of poker hands.
8
8
  ## Testing
9
9
 
10
10
  In order to run the tests for this track, you will need to install
11
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
11
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
12
12
 
13
13
  ### Loading Exercises into Delphi
14
14
 
@@ -20,7 +20,7 @@ Convert a number to a string, the contents of which depend on the number's facto
20
20
  ## Testing
21
21
 
22
22
  In order to run the tests for this track, you will need to install
23
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
23
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
24
24
 
25
25
  ### Loading Exercises into Delphi
26
26
 
@@ -9,7 +9,7 @@ output: "looc"
9
9
  ## Testing
10
10
 
11
11
  In order to run the tests for this track, you will need to install
12
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
12
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
13
13
 
14
14
  ### Loading Exercises into Delphi
15
15
 
@@ -21,7 +21,7 @@ each nucleotide with its complement:
21
21
  ## Testing
22
22
 
23
23
  In order to run the tests for this track, you will need to install
24
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
24
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
25
25
 
26
26
  ### Loading Exercises into Delphi
27
27
 
@@ -45,7 +45,7 @@ See also: http://www.novaroma.org/via_romana/numbers.html
45
45
  ## Testing
46
46
 
47
47
  In order to run the tests for this track, you will need to install
48
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
48
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
49
49
 
50
50
  ### Loading Exercises into Delphi
51
51
 
@@ -29,7 +29,7 @@ but the tests for this exercise follow the above unambiguous definition.
29
29
  ## Testing
30
30
 
31
31
  In order to run the tests for this track, you will need to install
32
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
32
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
33
33
 
34
34
  ### Loading Exercises into Delphi
35
35
 
@@ -25,7 +25,7 @@ a single line. Feel free to add your own code/tests to check for degenerate tria
25
25
  ## Testing
26
26
 
27
27
  In order to run the tests for this track, you will need to install
28
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
28
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
29
29
 
30
30
  ### Loading Exercises into Delphi
31
31
 
@@ -15,7 +15,7 @@ If no name is given, the result should be "One for you, one for me."
15
15
  ## Testing
16
16
 
17
17
  In order to run the tests for this track, you will need to install
18
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
18
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
19
19
 
20
20
  ### Loading Exercises into Delphi
21
21
 
@@ -54,7 +54,7 @@ If you'd like, handle exponentials.
54
54
  ## Testing
55
55
 
56
56
  In order to run the tests for this track, you will need to install
57
- DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installing) instructions for more information.
57
+ DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
58
58
 
59
59
  ### Loading Exercises into Delphi
60
60
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  language: node_js
3
3
  node_js:
4
- - '7.8'
4
+ - 'node'
5
5
  sudo: false
6
6
  script:
7
7
  - bin/fetch-configlet
@@ -17,11 +17,6 @@ TSTFILE := "$(subst _,-,$(ASSIGNMENT)).spec.$(FILEEXT)"
17
17
  SOURCE_PKG_MD5 ?= "`./bin/md5-hash ./package.json`"
18
18
  PKG_FILES= $(shell find ./exercises/*/* -maxdepth 1 -name package.json)
19
19
 
20
- test-package-files:
21
- @for pkg in $(PKG_FILES); do \
22
- ! ./bin/md5-hash $$pkg | grep -qv $(SOURCE_PKG_MD5) || { echo "$$pkg does not match main package.json"; exit 1; }; \
23
- done
24
-
25
20
  copy-assignment:
26
21
  @cp package.json exercises/$(ASSIGNMENT)
27
22
  @mkdir -p $(OUTDIR)
@@ -37,6 +32,10 @@ test-assignment:
37
32
  @rm -rf $(OUTDIR)
38
33
 
39
34
  test-travis:
35
+ @echo "Checking that exercise package.json files match main package.json..."
36
+ @for pkg in $(PKG_FILES); do \
37
+ ! ./bin/md5-hash $$pkg | grep -qv $(SOURCE_PKG_MD5) || { echo "$$pkg does not match main package.json. Please run 'make test' locally and commit the results."; exit 1; }; \
38
+ done
40
39
  @echo "Preparing tests..."
41
40
  @for assignment in $(ASSIGNMENTS); do ASSIGNMENT=$$assignment $(MAKE) -s copy-assignment || exit 1; done
42
41
  @node_modules/.bin/jest --bail $(OUTDIR)
@@ -25,7 +25,8 @@ and suggesting changes that conform to best practices.
25
25
  The make script will test all exercises:
26
26
 
27
27
  make test
28
-
28
+
29
+ Note: `make test` is recommended BEFORE submitting a PR. It will test your submission, and help guard against unintentional, unrelated changes.
29
30
  #### Test Specific Assignment
30
31
  Pass the exercise name to make script to run the tests for a specific exercise:
31
32
 
@@ -510,6 +510,18 @@
510
510
  "Exception handling"
511
511
  ]
512
512
  },
513
+ {
514
+ "uuid": "303c6969-9446-41aa-871a-11223a43e810",
515
+ "slug": "react",
516
+ "core": false,
517
+ "unlocked_by": null,
518
+ "difficulty": 8,
519
+ "topics": [
520
+ "Algorithms",
521
+ "Events",
522
+ "Reactive programming"
523
+ ]
524
+ },
513
525
  {
514
526
  "uuid": "f77ac2d1-cf3a-497d-bf04-b484a5a9cb37",
515
527
  "slug": "raindrops",