trackler 2.2.1.171 → 2.2.1.172

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/go/exercises/dominoes/.meta/gen.go +1 -1
  4. data/tracks/go/exercises/dominoes/cases_test.go +11 -11
  5. data/tracks/ocaml/config.json +1 -1
  6. data/tracks/ocaml/docs/ABOUT.md +6 -4
  7. data/tracks/powershell/config.json +3 -2
  8. data/tracks/rust/bin/format_exercises +31 -0
  9. data/tracks/rust/config.json +10 -2
  10. data/tracks/rust/config/exercise_readme.go.tmpl +26 -5
  11. data/tracks/rust/exercises/accumulate/README.md +26 -5
  12. data/tracks/rust/exercises/accumulate/src/lib.rs +1 -0
  13. data/tracks/rust/exercises/accumulate/tests/accumulate.rs +7 -7
  14. data/tracks/rust/exercises/acronym/README.md +26 -5
  15. data/tracks/rust/exercises/acronym/src/lib.rs +1 -0
  16. data/tracks/rust/exercises/acronym/tests/acronym.rs +10 -5
  17. data/tracks/rust/exercises/all-your-base/README.md +26 -5
  18. data/tracks/rust/exercises/all-your-base/src/lib.rs +6 -1
  19. data/tracks/rust/exercises/all-your-base/tests/all-your-base.rs +68 -34
  20. data/tracks/rust/exercises/allergies/README.md +26 -5
  21. data/tracks/rust/exercises/allergies/src/lib.rs +1 -0
  22. data/tracks/rust/exercises/allergies/tests/allergies.rs +34 -26
  23. data/tracks/rust/exercises/alphametics/README.md +26 -5
  24. data/tracks/rust/exercises/alphametics/tests/alphametics.rs +44 -9
  25. data/tracks/rust/exercises/anagram/README.md +26 -5
  26. data/tracks/rust/exercises/anagram/src/lib.rs +1 -0
  27. data/tracks/rust/exercises/anagram/tests/anagram.rs +15 -4
  28. data/tracks/rust/exercises/armstrong-numbers/README.md +26 -5
  29. data/tracks/rust/exercises/atbash-cipher/README.md +26 -5
  30. data/tracks/rust/exercises/atbash-cipher/src/lib.rs +1 -1
  31. data/tracks/rust/exercises/atbash-cipher/tests/atbash-cipher.rs +16 -8
  32. data/tracks/rust/exercises/beer-song/README.md +26 -5
  33. data/tracks/rust/exercises/binary-search/README.md +26 -5
  34. data/tracks/rust/exercises/binary-search/src/lib.rs +1 -0
  35. data/tracks/rust/exercises/binary-search/tests/binary-search.rs +8 -4
  36. data/tracks/rust/exercises/bob/README.md +26 -5
  37. data/tracks/rust/exercises/bob/tests/bob.rs +32 -15
  38. data/tracks/rust/exercises/book-store/README.md +26 -5
  39. data/tracks/rust/exercises/book-store/src/lib.rs +4 -1
  40. data/tracks/rust/exercises/book-store/tests/book-store.rs +52 -24
  41. data/tracks/rust/exercises/bowling/README.md +26 -5
  42. data/tracks/rust/exercises/bowling/src/lib.rs +1 -2
  43. data/tracks/rust/exercises/bowling/tests/bowling.rs +2 -1
  44. data/tracks/rust/exercises/bracket-push/README.md +29 -7
  45. data/tracks/rust/exercises/bracket-push/src/lib.rs +1 -0
  46. data/tracks/rust/exercises/circular-buffer/README.md +26 -5
  47. data/tracks/rust/exercises/circular-buffer/src/lib.rs +1 -0
  48. data/tracks/rust/exercises/clock/README.md +26 -5
  49. data/tracks/rust/exercises/clock/src/lib.rs +1 -0
  50. data/tracks/rust/exercises/clock/tests/clock.rs +0 -1
  51. data/tracks/rust/exercises/collatz-conjecture/README.md +26 -5
  52. data/tracks/rust/exercises/crypto-square/README.md +53 -29
  53. data/tracks/rust/exercises/custom-set/README.md +26 -5
  54. data/tracks/rust/exercises/custom-set/src/lib.rs +1 -0
  55. data/tracks/rust/exercises/decimal/README.md +26 -5
  56. data/tracks/rust/exercises/decimal/tests/decimal.rs +4 -7
  57. data/tracks/rust/exercises/diamond/README.md +26 -5
  58. data/tracks/rust/exercises/difference-of-squares/README.md +26 -5
  59. data/tracks/rust/exercises/difference-of-squares/src/lib.rs +1 -1
  60. data/tracks/rust/exercises/diffie-hellman/README.md +26 -5
  61. data/tracks/rust/exercises/diffie-hellman/src/lib.rs +12 -2
  62. data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +3 -3
  63. data/tracks/rust/exercises/dominoes/README.md +26 -5
  64. data/tracks/rust/exercises/dominoes/src/lib.rs +1 -0
  65. data/tracks/rust/exercises/dominoes/tests/dominoes.rs +29 -13
  66. data/tracks/rust/exercises/etl/README.md +26 -5
  67. data/tracks/rust/exercises/etl/src/lib.rs +1 -0
  68. data/tracks/rust/exercises/etl/tests/etl.rs +39 -34
  69. data/tracks/rust/exercises/forth/README.md +26 -5
  70. data/tracks/rust/exercises/forth/tests/forth.rs +17 -65
  71. data/tracks/rust/exercises/gigasecond/README.md +26 -5
  72. data/tracks/rust/exercises/gigasecond/tests/gigasecond.rs +31 -10
  73. data/tracks/rust/exercises/grade-school/README.md +26 -5
  74. data/tracks/rust/exercises/grade-school/src/lib.rs +1 -2
  75. data/tracks/rust/exercises/grade-school/tests/grade-school.rs +5 -9
  76. data/tracks/rust/exercises/grains/README.md +26 -5
  77. data/tracks/rust/exercises/hamming/README.md +30 -8
  78. data/tracks/rust/exercises/hamming/src/lib.rs +1 -2
  79. data/tracks/rust/exercises/hello-world/README.md +26 -5
  80. data/tracks/rust/exercises/hexadecimal/README.md +26 -5
  81. data/tracks/rust/exercises/hexadecimal/src/lib.rs +1 -0
  82. data/tracks/rust/exercises/isbn-verifier/README.md +26 -5
  83. data/tracks/rust/exercises/isogram/README.md +26 -5
  84. data/tracks/rust/exercises/isogram/src/lib.rs +1 -1
  85. data/tracks/rust/exercises/isogram/tests/isogram.rs +36 -24
  86. data/tracks/rust/exercises/largest-series-product/README.md +26 -5
  87. data/tracks/rust/exercises/largest-series-product/src/lib.rs +5 -1
  88. data/tracks/rust/exercises/largest-series-product/tests/largest-series-product.rs +4 -2
  89. data/tracks/rust/exercises/leap/README.md +26 -5
  90. data/tracks/rust/exercises/luhn-from/README.md +26 -5
  91. data/tracks/rust/exercises/luhn-from/src/lib.rs +1 -0
  92. data/tracks/rust/exercises/luhn-trait/README.md +26 -5
  93. data/tracks/rust/exercises/luhn-trait/src/lib.rs +1 -0
  94. data/tracks/rust/exercises/luhn/README.md +26 -5
  95. data/tracks/rust/exercises/luhn/src/lib.rs +1 -1
  96. data/tracks/rust/exercises/macros/README.md +26 -5
  97. data/tracks/rust/exercises/minesweeper/README.md +26 -5
  98. data/tracks/rust/exercises/minesweeper/src/lib.rs +1 -0
  99. data/tracks/rust/exercises/nth-prime/README.md +26 -5
  100. data/tracks/rust/exercises/nucleotide-codons/README.md +26 -5
  101. data/tracks/rust/exercises/nucleotide-codons/src/lib.rs +1 -0
  102. data/tracks/rust/exercises/nucleotide-codons/tests/codons.rs +6 -5
  103. data/tracks/rust/exercises/nucleotide-count/README.md +26 -5
  104. data/tracks/rust/exercises/nucleotide-count/src/lib.rs +1 -0
  105. data/tracks/rust/exercises/nucleotide-count/tests/nucleotide-count.rs +5 -8
  106. data/tracks/rust/exercises/ocr-numbers/README.md +26 -5
  107. data/tracks/rust/exercises/ocr-numbers/tests/ocr-numbers.rs +0 -1
  108. data/tracks/rust/exercises/palindrome-products/README.md +26 -5
  109. data/tracks/rust/exercises/pangram/README.md +26 -5
  110. data/tracks/rust/exercises/pangram/src/lib.rs +1 -1
  111. data/tracks/rust/exercises/parallel-letter-frequency/README.md +26 -5
  112. data/tracks/rust/exercises/parallel-letter-frequency/benches/benchmark.rs +6 -3
  113. data/tracks/rust/exercises/parallel-letter-frequency/src/lib.rs +1 -0
  114. data/tracks/rust/exercises/parallel-letter-frequency/tests/parallel-letter-frequency.rs +6 -3
  115. data/tracks/rust/exercises/pascals-triangle/README.md +26 -5
  116. data/tracks/rust/exercises/pascals-triangle/tests/pascals-triangle.rs +36 -28
  117. data/tracks/rust/exercises/perfect-numbers/README.md +26 -5
  118. data/tracks/rust/exercises/perfect-numbers/src/lib.rs +1 -1
  119. data/tracks/rust/exercises/perfect-numbers/tests/perfect-numbers.rs +1 -2
  120. data/tracks/rust/exercises/phone-number/README.md +26 -5
  121. data/tracks/rust/exercises/phone-number/src/lib.rs +1 -0
  122. data/tracks/rust/exercises/pig-latin/README.md +26 -5
  123. data/tracks/rust/exercises/pig-latin/src/lib.rs +1 -0
  124. data/tracks/rust/exercises/poker/README.md +26 -5
  125. data/tracks/rust/exercises/poker/tests/poker.rs +27 -104
  126. data/tracks/rust/exercises/prime-factors/README.md +26 -5
  127. data/tracks/rust/exercises/protein-translation/README.md +26 -5
  128. data/tracks/rust/exercises/protein-translation/src/lib.rs +1 -0
  129. data/tracks/rust/exercises/protein-translation/tests/proteins.rs +16 -9
  130. data/tracks/rust/exercises/proverb/README.md +26 -5
  131. data/tracks/rust/exercises/proverb/tests/proverb.rs +1 -7
  132. data/tracks/rust/exercises/pythagorean-triplet/README.md +26 -5
  133. data/tracks/rust/exercises/queen-attack/README.md +26 -5
  134. data/tracks/rust/exercises/queen-attack/src/lib.rs +1 -0
  135. data/tracks/rust/exercises/raindrops/README.md +26 -5
  136. data/tracks/rust/exercises/raindrops/tests/raindrops.rs +57 -19
  137. data/tracks/rust/exercises/react/README.md +26 -5
  138. data/tracks/rust/exercises/react/src/lib.rs +16 -4
  139. data/tracks/rust/exercises/react/tests/react.rs +174 -43
  140. data/tracks/rust/exercises/rectangles/README.md +26 -5
  141. data/tracks/rust/exercises/rectangles/src/lib.rs +1 -0
  142. data/tracks/rust/exercises/reverse-string/README.md +26 -5
  143. data/tracks/rust/exercises/reverse-string/tests/reverse-string.rs +2 -11
  144. data/tracks/rust/exercises/rna-transcription/README.md +26 -5
  145. data/tracks/rust/exercises/rna-transcription/src/lib.rs +1 -0
  146. data/tracks/rust/exercises/robot-name/README.md +26 -5
  147. data/tracks/rust/exercises/robot-name/src/lib.rs +1 -0
  148. data/tracks/rust/exercises/robot-name/tests/robot-name.rs +8 -2
  149. data/tracks/rust/exercises/robot-simulator/README.md +26 -5
  150. data/tracks/rust/exercises/robot-simulator/src/lib.rs +5 -6
  151. data/tracks/rust/exercises/roman-numerals/README.md +26 -5
  152. data/tracks/rust/exercises/roman-numerals/src/lib.rs +1 -0
  153. data/tracks/rust/exercises/rotational-cipher/README.md +26 -5
  154. data/tracks/rust/exercises/rotational-cipher/src/lib.rs +1 -0
  155. data/tracks/rust/exercises/rotational-cipher/tests/rotational-cipher.rs +12 -4
  156. data/tracks/rust/exercises/run-length-encoding/README.md +26 -5
  157. data/tracks/rust/exercises/run-length-encoding/src/lib.rs +1 -1
  158. data/tracks/rust/exercises/run-length-encoding/tests/run-length-encoding.rs +12 -5
  159. data/tracks/rust/exercises/saddle-points/README.md +26 -5
  160. data/tracks/rust/exercises/saddle-points/src/lib.rs +4 -1
  161. data/tracks/rust/exercises/say/README.md +27 -6
  162. data/tracks/rust/exercises/say/src/lib.rs +1 -1
  163. data/tracks/rust/exercises/say/tests/say.rs +30 -14
  164. data/tracks/rust/exercises/scrabble-score/README.md +26 -5
  165. data/tracks/rust/exercises/scrabble-score/src/lib.rs +1 -1
  166. data/tracks/rust/exercises/series/README.md +32 -11
  167. data/tracks/rust/exercises/series/src/lib.rs +5 -1
  168. data/tracks/rust/exercises/sieve/README.md +31 -8
  169. data/tracks/rust/exercises/sieve/src/lib.rs +1 -0
  170. data/tracks/rust/exercises/sieve/tests/sieve.rs +11 -12
  171. data/tracks/rust/exercises/simple-cipher/README.md +26 -5
  172. data/tracks/rust/exercises/simple-cipher/src/lib.rs +6 -3
  173. data/tracks/rust/exercises/simple-cipher/tests/simple-cipher.rs +0 -1
  174. data/tracks/rust/exercises/simple-linked-list/README.md +26 -5
  175. data/tracks/rust/exercises/simple-linked-list/src/lib.rs +0 -1
  176. data/tracks/rust/exercises/simple-linked-list/tests/simple-linked-list.rs +0 -1
  177. data/tracks/rust/exercises/space-age/README.md +26 -5
  178. data/tracks/rust/exercises/space-age/tests/space-age.rs +4 -4
  179. data/tracks/rust/exercises/spiral-matrix/README.md +26 -5
  180. data/tracks/rust/exercises/sublist/README.md +26 -5
  181. data/tracks/rust/exercises/sublist/src/lib.rs +1 -0
  182. data/tracks/rust/exercises/sublist/tests/sublist.rs +17 -68
  183. data/tracks/rust/exercises/sum-of-multiples/README.md +26 -5
  184. data/tracks/rust/exercises/sum-of-multiples/src/lib.rs +5 -1
  185. data/tracks/rust/exercises/tournament/README.md +26 -5
  186. data/tracks/rust/exercises/tournament/src/lib.rs +1 -0
  187. data/tracks/rust/exercises/tournament/tests/tournament.rs +60 -60
  188. data/tracks/rust/exercises/triangle/README.md +26 -5
  189. data/tracks/rust/exercises/triangle/src/lib.rs +1 -0
  190. data/tracks/rust/exercises/two-bucket/README.md +26 -5
  191. data/tracks/rust/exercises/two-bucket/src/lib.rs +2 -6
  192. data/tracks/rust/exercises/two-bucket/tests/two-bucket.rs +49 -37
  193. data/tracks/rust/exercises/twofer/README.md +33 -7
  194. data/tracks/rust/exercises/twofer/src/lib.rs +2 -2
  195. data/tracks/rust/exercises/twofer/tests/two-fer.rs +2 -2
  196. data/tracks/rust/exercises/variable-length-quantity/README.md +26 -5
  197. data/tracks/rust/exercises/variable-length-quantity/tests/variable-length-quantity.rs +60 -32
  198. data/tracks/rust/exercises/word-count/README.md +26 -5
  199. data/tracks/rust/exercises/word-count/src/lib.rs +1 -1
  200. data/tracks/rust/exercises/word-count/tests/word-count.rs +15 -23
  201. data/tracks/rust/exercises/wordy/README.md +26 -5
  202. data/tracks/rust/exercises/wordy/src/lib.rs +1 -0
  203. metadata +3 -2
@@ -21,11 +21,31 @@ Execute the tests with:
21
21
  $ cargo test
22
22
  ```
23
23
 
24
- All but the first test have been ignored. After you get the first test to
25
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
26
- to pass again. The test file is located in the `tests` directory. You can
27
- also remove the ignore flag from all the tests to get them to run all at once
28
- if you wish.
24
+ All but the first test have been ignored. After you get the first test to
25
+ pass, open the tests source file wich is located in the `tests` directory
26
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
27
+ again. Each separate test is a function with `#[test]` flag above it.
28
+ Continue, until you pass every test.
29
+
30
+ If you wish to run all tests without editing the tests source file, use:
31
+
32
+ ```bash
33
+ $ cargo test -- --ignored
34
+ ```
35
+
36
+ To run a specific test, for example `some_test`, you can use:
37
+
38
+ ```bash
39
+ $ cargo test some_test
40
+ ```
41
+
42
+ If the specfic test is ignored use:
43
+
44
+ ```bash
45
+ $ cargo test some_test -- --ignored
46
+ ```
47
+
48
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
29
49
 
30
50
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
31
51
  haven't already, it will help you with organizing your files.
@@ -39,6 +59,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
39
59
  [help-page]: http://exercism.io/languages/rust
40
60
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
41
61
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
62
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
42
63
 
43
64
  ## Source
44
65
 
@@ -1,3 +1,7 @@
1
1
  pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 {
2
- unimplemented!("Sum the multiples of all of {:?} which are less than {}", factors, limit)
2
+ unimplemented!(
3
+ "Sum the multiples of all of {:?} which are less than {}",
4
+ factors,
5
+ limit
6
+ )
3
7
  }
@@ -77,11 +77,31 @@ Execute the tests with:
77
77
  $ cargo test
78
78
  ```
79
79
 
80
- All but the first test have been ignored. After you get the first test to
81
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
82
- to pass again. The test file is located in the `tests` directory. You can
83
- also remove the ignore flag from all the tests to get them to run all at once
84
- if you wish.
80
+ All but the first test have been ignored. After you get the first test to
81
+ pass, open the tests source file wich is located in the `tests` directory
82
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
83
+ again. Each separate test is a function with `#[test]` flag above it.
84
+ Continue, until you pass every test.
85
+
86
+ If you wish to run all tests without editing the tests source file, use:
87
+
88
+ ```bash
89
+ $ cargo test -- --ignored
90
+ ```
91
+
92
+ To run a specific test, for example `some_test`, you can use:
93
+
94
+ ```bash
95
+ $ cargo test some_test
96
+ ```
97
+
98
+ If the specfic test is ignored use:
99
+
100
+ ```bash
101
+ $ cargo test some_test -- --ignored
102
+ ```
103
+
104
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
85
105
 
86
106
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
87
107
  haven't already, it will help you with organizing your files.
@@ -95,6 +115,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
95
115
  [help-page]: http://exercism.io/languages/rust
96
116
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
97
117
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
118
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
98
119
 
99
120
  ## Submitting Incomplete Solutions
100
121
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -12,9 +12,9 @@ fn just_the_header_if_no_input() {
12
12
  #[ignore]
13
13
  fn a_win_is_three_points_a_loss_is_zero_points() {
14
14
  let input = "Allegoric Alaskans;Blithering Badgers;win";
15
- let expected = "Team | MP | W | D | L | P\n".to_string() +
16
- "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n" +
17
- "Blithering Badgers | 1 | 0 | 0 | 1 | 0";
15
+ let expected = "Team | MP | W | D | L | P\n".to_string()
16
+ + "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n"
17
+ + "Blithering Badgers | 1 | 0 | 0 | 1 | 0";
18
18
 
19
19
  assert_eq!(tournament::tally(&input), expected);
20
20
  }
@@ -23,9 +23,9 @@ fn a_win_is_three_points_a_loss_is_zero_points() {
23
23
  #[ignore]
24
24
  fn a_win_can_also_be_expressed_as_a_loss() {
25
25
  let input = "Blithering Badgers;Allegoric Alaskans;loss";
26
- let expected = "Team | MP | W | D | L | P\n".to_string() +
27
- "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n" +
28
- "Blithering Badgers | 1 | 0 | 0 | 1 | 0";
26
+ let expected = "Team | MP | W | D | L | P\n".to_string()
27
+ + "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n"
28
+ + "Blithering Badgers | 1 | 0 | 0 | 1 | 0";
29
29
 
30
30
  assert_eq!(tournament::tally(&input), expected);
31
31
  }
@@ -34,9 +34,9 @@ fn a_win_can_also_be_expressed_as_a_loss() {
34
34
  #[ignore]
35
35
  fn a_different_team_can_win() {
36
36
  let input = "Blithering Badgers;Allegoric Alaskans;win";
37
- let expected = "Team | MP | W | D | L | P\n".to_string() +
38
- "Blithering Badgers | 1 | 1 | 0 | 0 | 3\n" +
39
- "Allegoric Alaskans | 1 | 0 | 0 | 1 | 0";
37
+ let expected = "Team | MP | W | D | L | P\n".to_string()
38
+ + "Blithering Badgers | 1 | 1 | 0 | 0 | 3\n"
39
+ + "Allegoric Alaskans | 1 | 0 | 0 | 1 | 0";
40
40
 
41
41
  assert_eq!(tournament::tally(&input), expected);
42
42
  }
@@ -45,9 +45,9 @@ fn a_different_team_can_win() {
45
45
  #[ignore]
46
46
  fn a_draw_is_one_point_each() {
47
47
  let input = "Allegoric Alaskans;Blithering Badgers;draw";
48
- let expected = "Team | MP | W | D | L | P\n".to_string() +
49
- "Allegoric Alaskans | 1 | 0 | 1 | 0 | 1\n" +
50
- "Blithering Badgers | 1 | 0 | 1 | 0 | 1";
48
+ let expected = "Team | MP | W | D | L | P\n".to_string()
49
+ + "Allegoric Alaskans | 1 | 0 | 1 | 0 | 1\n"
50
+ + "Blithering Badgers | 1 | 0 | 1 | 0 | 1";
51
51
 
52
52
  assert_eq!(tournament::tally(&input), expected);
53
53
  }
@@ -55,11 +55,11 @@ fn a_draw_is_one_point_each() {
55
55
  #[test]
56
56
  #[ignore]
57
57
  fn there_can_be_more_than_one_match() {
58
- let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string() +
59
- "Allegoric Alaskans;Blithering Badgers;win";
60
- let expected = "Team | MP | W | D | L | P\n".to_string() +
61
- "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n" +
62
- "Blithering Badgers | 2 | 0 | 0 | 2 | 0";
58
+ let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string()
59
+ + "Allegoric Alaskans;Blithering Badgers;win";
60
+ let expected = "Team | MP | W | D | L | P\n".to_string()
61
+ + "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n"
62
+ + "Blithering Badgers | 2 | 0 | 0 | 2 | 0";
63
63
 
64
64
  assert_eq!(tournament::tally(&input), expected);
65
65
  }
@@ -67,11 +67,11 @@ fn there_can_be_more_than_one_match() {
67
67
  #[test]
68
68
  #[ignore]
69
69
  fn there_can_be_more_than_one_winner() {
70
- let input = "Allegoric Alaskans;Blithering Badgers;loss\n".to_string() +
71
- "Allegoric Alaskans;Blithering Badgers;win";
72
- let expected = "Team | MP | W | D | L | P\n".to_string() +
73
- "Allegoric Alaskans | 2 | 1 | 0 | 1 | 3\n" +
74
- "Blithering Badgers | 2 | 1 | 0 | 1 | 3";
70
+ let input = "Allegoric Alaskans;Blithering Badgers;loss\n".to_string()
71
+ + "Allegoric Alaskans;Blithering Badgers;win";
72
+ let expected = "Team | MP | W | D | L | P\n".to_string()
73
+ + "Allegoric Alaskans | 2 | 1 | 0 | 1 | 3\n"
74
+ + "Blithering Badgers | 2 | 1 | 0 | 1 | 3";
75
75
 
76
76
  assert_eq!(tournament::tally(&input), expected);
77
77
  }
@@ -79,13 +79,13 @@ fn there_can_be_more_than_one_winner() {
79
79
  #[test]
80
80
  #[ignore]
81
81
  fn there_can_be_more_than_two_teams() {
82
- let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string() +
83
- "Blithering Badgers;Courageous Californians;win\n" +
84
- "Courageous Californians;Allegoric Alaskans;loss";
85
- let expected = "Team | MP | W | D | L | P\n".to_string() +
86
- "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n" +
87
- "Blithering Badgers | 2 | 1 | 0 | 1 | 3\n" +
88
- "Courageous Californians | 2 | 0 | 0 | 2 | 0";
82
+ let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string()
83
+ + "Blithering Badgers;Courageous Californians;win\n"
84
+ + "Courageous Californians;Allegoric Alaskans;loss";
85
+ let expected = "Team | MP | W | D | L | P\n".to_string()
86
+ + "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n"
87
+ + "Blithering Badgers | 2 | 1 | 0 | 1 | 3\n"
88
+ + "Courageous Californians | 2 | 0 | 0 | 2 | 0";
89
89
 
90
90
  assert_eq!(tournament::tally(&input), expected);
91
91
  }
@@ -93,17 +93,17 @@ fn there_can_be_more_than_two_teams() {
93
93
  #[test]
94
94
  #[ignore]
95
95
  fn typical_input() {
96
- let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string() +
97
- "Devastating Donkeys;Courageous Californians;draw\n" +
98
- "Devastating Donkeys;Allegoric Alaskans;win\n" +
99
- "Courageous Californians;Blithering Badgers;loss\n" +
100
- "Blithering Badgers;Devastating Donkeys;loss\n" +
101
- "Allegoric Alaskans;Courageous Californians;win";
102
- let expected = "Team | MP | W | D | L | P\n".to_string() +
103
- "Devastating Donkeys | 3 | 2 | 1 | 0 | 7\n" +
104
- "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n" +
105
- "Blithering Badgers | 3 | 1 | 0 | 2 | 3\n" +
106
- "Courageous Californians | 3 | 0 | 1 | 2 | 1";
96
+ let input = "Allegoric Alaskans;Blithering Badgers;win\n".to_string()
97
+ + "Devastating Donkeys;Courageous Californians;draw\n"
98
+ + "Devastating Donkeys;Allegoric Alaskans;win\n"
99
+ + "Courageous Californians;Blithering Badgers;loss\n"
100
+ + "Blithering Badgers;Devastating Donkeys;loss\n"
101
+ + "Allegoric Alaskans;Courageous Californians;win";
102
+ let expected = "Team | MP | W | D | L | P\n".to_string()
103
+ + "Devastating Donkeys | 3 | 2 | 1 | 0 | 7\n"
104
+ + "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n"
105
+ + "Blithering Badgers | 3 | 1 | 0 | 2 | 3\n"
106
+ + "Courageous Californians | 3 | 0 | 1 | 2 | 1";
107
107
 
108
108
  assert_eq!(tournament::tally(&input), expected);
109
109
  }
@@ -111,15 +111,15 @@ fn typical_input() {
111
111
  #[test]
112
112
  #[ignore]
113
113
  fn incomplete_competition_not_all_pairs_have_played() {
114
- let input = "Allegoric Alaskans;Blithering Badgers;loss\n".to_string() +
115
- "Devastating Donkeys;Allegoric Alaskans;loss\n" +
116
- "Courageous Californians;Blithering Badgers;draw\n" +
117
- "Allegoric Alaskans;Courageous Californians;win";
118
- let expected = "Team | MP | W | D | L | P\n".to_string() +
119
- "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n" +
120
- "Blithering Badgers | 2 | 1 | 1 | 0 | 4\n" +
121
- "Courageous Californians | 2 | 0 | 1 | 1 | 1\n" +
122
- "Devastating Donkeys | 1 | 0 | 0 | 1 | 0";
114
+ let input = "Allegoric Alaskans;Blithering Badgers;loss\n".to_string()
115
+ + "Devastating Donkeys;Allegoric Alaskans;loss\n"
116
+ + "Courageous Californians;Blithering Badgers;draw\n"
117
+ + "Allegoric Alaskans;Courageous Californians;win";
118
+ let expected = "Team | MP | W | D | L | P\n".to_string()
119
+ + "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n"
120
+ + "Blithering Badgers | 2 | 1 | 1 | 0 | 4\n"
121
+ + "Courageous Californians | 2 | 0 | 1 | 1 | 1\n"
122
+ + "Devastating Donkeys | 1 | 0 | 0 | 1 | 0";
123
123
 
124
124
  assert_eq!(tournament::tally(&input), expected);
125
125
  }
@@ -127,17 +127,17 @@ fn incomplete_competition_not_all_pairs_have_played() {
127
127
  #[test]
128
128
  #[ignore]
129
129
  fn ties_broken_alphabetically() {
130
- let input = "Courageous Californians;Devastating Donkeys;win\n".to_string() +
131
- "Allegoric Alaskans;Blithering Badgers;win\n" +
132
- "Devastating Donkeys;Allegoric Alaskans;loss\n" +
133
- "Courageous Californians;Blithering Badgers;win\n" +
134
- "Blithering Badgers;Devastating Donkeys;draw\n" +
135
- "Allegoric Alaskans;Courageous Californians;draw";
136
- let expected = "Team | MP | W | D | L | P\n".to_string() +
137
- "Allegoric Alaskans | 3 | 2 | 1 | 0 | 7\n" +
138
- "Courageous Californians | 3 | 2 | 1 | 0 | 7\n" +
139
- "Blithering Badgers | 3 | 0 | 1 | 2 | 1\n" +
140
- "Devastating Donkeys | 3 | 0 | 1 | 2 | 1";
130
+ let input = "Courageous Californians;Devastating Donkeys;win\n".to_string()
131
+ + "Allegoric Alaskans;Blithering Badgers;win\n"
132
+ + "Devastating Donkeys;Allegoric Alaskans;loss\n"
133
+ + "Courageous Californians;Blithering Badgers;win\n"
134
+ + "Blithering Badgers;Devastating Donkeys;draw\n"
135
+ + "Allegoric Alaskans;Courageous Californians;draw";
136
+ let expected = "Team | MP | W | D | L | P\n".to_string()
137
+ + "Allegoric Alaskans | 3 | 2 | 1 | 0 | 7\n"
138
+ + "Courageous Californians | 3 | 2 | 1 | 0 | 7\n"
139
+ + "Blithering Badgers | 3 | 0 | 1 | 2 | 1\n"
140
+ + "Devastating Donkeys | 3 | 0 | 1 | 2 | 1";
141
141
 
142
142
  assert_eq!(tournament::tally(&input), expected);
143
143
  }
@@ -48,11 +48,31 @@ Execute the tests with:
48
48
  $ cargo test
49
49
  ```
50
50
 
51
- All but the first test have been ignored. After you get the first test to
52
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
53
- to pass again. The test file is located in the `tests` directory. You can
54
- also remove the ignore flag from all the tests to get them to run all at once
55
- if you wish.
51
+ All but the first test have been ignored. After you get the first test to
52
+ pass, open the tests source file wich is located in the `tests` directory
53
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
54
+ again. Each separate test is a function with `#[test]` flag above it.
55
+ Continue, until you pass every test.
56
+
57
+ If you wish to run all tests without editing the tests source file, use:
58
+
59
+ ```bash
60
+ $ cargo test -- --ignored
61
+ ```
62
+
63
+ To run a specific test, for example `some_test`, you can use:
64
+
65
+ ```bash
66
+ $ cargo test some_test
67
+ ```
68
+
69
+ If the specfic test is ignored use:
70
+
71
+ ```bash
72
+ $ cargo test some_test -- --ignored
73
+ ```
74
+
75
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
56
76
 
57
77
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
58
78
  haven't already, it will help you with organizing your files.
@@ -66,6 +86,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
66
86
  [help-page]: http://exercism.io/languages/rust
67
87
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
68
88
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
89
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
69
90
 
70
91
  ## Source
71
92
 
@@ -42,11 +42,31 @@ Execute the tests with:
42
42
  $ cargo test
43
43
  ```
44
44
 
45
- All but the first test have been ignored. After you get the first test to
46
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
47
- to pass again. The test file is located in the `tests` directory. You can
48
- also remove the ignore flag from all the tests to get them to run all at once
49
- if you wish.
45
+ All but the first test have been ignored. After you get the first test to
46
+ pass, open the tests source file wich is located in the `tests` directory
47
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
48
+ again. Each separate test is a function with `#[test]` flag above it.
49
+ Continue, until you pass every test.
50
+
51
+ If you wish to run all tests without editing the tests source file, use:
52
+
53
+ ```bash
54
+ $ cargo test -- --ignored
55
+ ```
56
+
57
+ To run a specific test, for example `some_test`, you can use:
58
+
59
+ ```bash
60
+ $ cargo test some_test
61
+ ```
62
+
63
+ If the specfic test is ignored use:
64
+
65
+ ```bash
66
+ $ cargo test some_test -- --ignored
67
+ ```
68
+
69
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
50
70
 
51
71
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
52
72
  haven't already, it will help you with organizing your files.
@@ -60,6 +80,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
60
80
  [help-page]: http://exercism.io/languages/rust
61
81
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
62
82
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
83
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
63
84
 
64
85
  ## Source
65
86
 
@@ -1,7 +1,7 @@
1
1
  #[derive(PartialEq, Eq, Debug)]
2
2
  pub enum Bucket {
3
3
  One,
4
- Two
4
+ Two,
5
5
  }
6
6
 
7
7
  /// A struct to hold your results in.
@@ -17,11 +17,7 @@ pub struct BucketStats {
17
17
  }
18
18
 
19
19
  /// Solve the bucket problem
20
- pub fn solve(capacity_1: u8,
21
- capacity_2: u8,
22
- goal: u8,
23
- start_bucket: &Bucket) -> BucketStats
24
- {
20
+ pub fn solve(capacity_1: u8, capacity_2: u8, goal: u8, start_bucket: &Bucket) -> BucketStats {
25
21
  unimplemented!(
26
22
  "Given one bucket of capacity {}, another of capacity {}, starting with {:?}, find pours to reach {}",
27
23
  capacity_1,
@@ -1,68 +1,80 @@
1
1
  extern crate two_bucket;
2
2
 
3
- use two_bucket::{solve, BucketStats, Bucket};
3
+ use two_bucket::{solve, Bucket, BucketStats};
4
4
 
5
5
  #[test]
6
6
  fn test_case_1() {
7
- assert_eq!(solve(3, 5, 1, &Bucket::One),
8
- BucketStats {
9
- moves: 4,
10
- goal_bucket: Bucket::One,
11
- other_bucket: 5,
12
- });
7
+ assert_eq!(
8
+ solve(3, 5, 1, &Bucket::One),
9
+ BucketStats {
10
+ moves: 4,
11
+ goal_bucket: Bucket::One,
12
+ other_bucket: 5,
13
+ }
14
+ );
13
15
  }
14
16
 
15
17
  #[test]
16
18
  #[ignore]
17
19
  fn test_case_2() {
18
- assert_eq!(solve(3, 5, 1, &Bucket::Two),
19
- BucketStats {
20
- moves: 8,
21
- goal_bucket: Bucket::Two,
22
- other_bucket: 3,
23
- });
20
+ assert_eq!(
21
+ solve(3, 5, 1, &Bucket::Two),
22
+ BucketStats {
23
+ moves: 8,
24
+ goal_bucket: Bucket::Two,
25
+ other_bucket: 3,
26
+ }
27
+ );
24
28
  }
25
29
 
26
30
  #[test]
27
31
  #[ignore]
28
32
  fn test_case_3() {
29
- assert_eq!(solve(7, 11, 2, &Bucket::One),
30
- BucketStats {
31
- moves: 14,
32
- goal_bucket: Bucket::One,
33
- other_bucket: 11,
34
- });
33
+ assert_eq!(
34
+ solve(7, 11, 2, &Bucket::One),
35
+ BucketStats {
36
+ moves: 14,
37
+ goal_bucket: Bucket::One,
38
+ other_bucket: 11,
39
+ }
40
+ );
35
41
  }
36
42
 
37
43
  #[test]
38
44
  #[ignore]
39
45
  fn test_case_4() {
40
- assert_eq!(solve(7, 11, 2, &Bucket::Two),
41
- BucketStats {
42
- moves: 18,
43
- goal_bucket: Bucket::Two,
44
- other_bucket: 7,
45
- });
46
+ assert_eq!(
47
+ solve(7, 11, 2, &Bucket::Two),
48
+ BucketStats {
49
+ moves: 18,
50
+ goal_bucket: Bucket::Two,
51
+ other_bucket: 7,
52
+ }
53
+ );
46
54
  }
47
55
 
48
56
  #[test]
49
57
  #[ignore]
50
58
  fn test_case_5() {
51
- assert_eq!(solve(1, 3, 3, &Bucket::Two),
52
- BucketStats {
53
- moves: 1,
54
- goal_bucket: Bucket::Two,
55
- other_bucket: 0,
56
- });
59
+ assert_eq!(
60
+ solve(1, 3, 3, &Bucket::Two),
61
+ BucketStats {
62
+ moves: 1,
63
+ goal_bucket: Bucket::Two,
64
+ other_bucket: 0,
65
+ }
66
+ );
57
67
  }
58
68
 
59
69
  #[test]
60
70
  #[ignore]
61
71
  fn test_case_6() {
62
- assert_eq!(solve(2, 3, 3, &Bucket::One),
63
- BucketStats {
64
- moves: 2,
65
- goal_bucket: Bucket::Two,
66
- other_bucket: 2,
67
- });
72
+ assert_eq!(
73
+ solve(2, 3, 3, &Bucket::One),
74
+ BucketStats {
75
+ moves: 2,
76
+ goal_bucket: Bucket::Two,
77
+ other_bucket: 2,
78
+ }
79
+ );
68
80
  }