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
@@ -4,4 +4,4 @@ pub fn encode(source: &str) -> String {
4
4
 
5
5
  pub fn decode(source: &str) -> String {
6
6
  unimplemented!("Return the run-length decoding of {}.", source);
7
- }
7
+ }
@@ -22,8 +22,10 @@ fn test_encode_string_with_no_single_characters() {
22
22
  #[test]
23
23
  #[ignore]
24
24
  fn test_encode_single_characters_mixed_with_repeated_characters() {
25
- assert_eq!("12WB12W3B24WB", rle::encode(
26
- "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"));
25
+ assert_eq!(
26
+ "12WB12W3B24WB",
27
+ rle::encode("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB")
28
+ );
27
29
  }
28
30
 
29
31
  #[test]
@@ -61,8 +63,10 @@ fn test_decode_string_with_no_single_characters() {
61
63
  #[test]
62
64
  #[ignore]
63
65
  fn test_decode_single_characters_with_repeated_characters() {
64
- assert_eq!("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",
65
- rle::decode("12WB12W3B24WB"));
66
+ assert_eq!(
67
+ "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",
68
+ rle::decode("12WB12W3B24WB")
69
+ );
66
70
  }
67
71
 
68
72
  #[test]
@@ -82,5 +86,8 @@ fn test_decode_lower_case_string() {
82
86
  #[test]
83
87
  #[ignore]
84
88
  fn test_consistency() {
85
- assert_eq!("zzz ZZ zZ", rle::decode(rle::encode("zzz ZZ zZ").as_str()));
89
+ assert_eq!(
90
+ "zzz ZZ zZ",
91
+ rle::decode(rle::encode("zzz ZZ zZ").as_str())
92
+ );
86
93
  }
@@ -39,11 +39,31 @@ Execute the tests with:
39
39
  $ cargo test
40
40
  ```
41
41
 
42
- All but the first test have been ignored. After you get the first test to
43
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
44
- to pass again. The test file is located in the `tests` directory. You can
45
- also remove the ignore flag from all the tests to get them to run all at once
46
- if you wish.
42
+ All but the first test have been ignored. After you get the first test to
43
+ pass, open the tests source file wich is located in the `tests` directory
44
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
45
+ again. Each separate test is a function with `#[test]` flag above it.
46
+ Continue, until you pass every test.
47
+
48
+ If you wish to run all tests without editing the tests source file, use:
49
+
50
+ ```bash
51
+ $ cargo test -- --ignored
52
+ ```
53
+
54
+ To run a specific test, for example `some_test`, you can use:
55
+
56
+ ```bash
57
+ $ cargo test some_test
58
+ ```
59
+
60
+ If the specfic test is ignored use:
61
+
62
+ ```bash
63
+ $ cargo test some_test -- --ignored
64
+ ```
65
+
66
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
47
67
 
48
68
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
49
69
  haven't already, it will help you with organizing your files.
@@ -57,6 +77,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
57
77
  [help-page]: http://exercism.io/languages/rust
58
78
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
59
79
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
80
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
60
81
 
61
82
  ## Source
62
83
 
@@ -1,3 +1,6 @@
1
1
  pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
2
- unimplemented!("find the saddle points of the following matrix: {:?}", input)
2
+ unimplemented!(
3
+ "find the saddle points of the following matrix: {:?}",
4
+ input
5
+ )
3
6
  }
@@ -24,7 +24,7 @@ Some good test cases for this program are:
24
24
  ### Extension
25
25
 
26
26
  If you're on a Mac, shell out to Mac OS X's `say` program to talk out
27
- loud.
27
+ loud. If you're on Linux or Windows, eSpeakNG may be available with the command `espeak`.
28
28
 
29
29
  ## Step 2
30
30
 
@@ -96,11 +96,31 @@ Execute the tests with:
96
96
  $ cargo test
97
97
  ```
98
98
 
99
- All but the first test have been ignored. After you get the first test to
100
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
101
- to pass again. The test file is located in the `tests` directory. You can
102
- also remove the ignore flag from all the tests to get them to run all at once
103
- if you wish.
99
+ All but the first test have been ignored. After you get the first test to
100
+ pass, open the tests source file wich is located in the `tests` directory
101
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
102
+ again. Each separate test is a function with `#[test]` flag above it.
103
+ Continue, until you pass every test.
104
+
105
+ If you wish to run all tests without editing the tests source file, use:
106
+
107
+ ```bash
108
+ $ cargo test -- --ignored
109
+ ```
110
+
111
+ To run a specific test, for example `some_test`, you can use:
112
+
113
+ ```bash
114
+ $ cargo test some_test
115
+ ```
116
+
117
+ If the specfic test is ignored use:
118
+
119
+ ```bash
120
+ $ cargo test some_test -- --ignored
121
+ ```
122
+
123
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
104
124
 
105
125
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
106
126
  haven't already, it will help you with organizing your files.
@@ -114,6 +134,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
114
134
  [help-page]: http://exercism.io/languages/rust
115
135
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
116
136
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
137
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
117
138
 
118
139
  ## Source
119
140
 
@@ -1,3 +1,3 @@
1
1
  pub fn encode(n: u64) -> String {
2
2
  unimplemented!("Say {} in English.", n);
3
- }
3
+ }
@@ -72,14 +72,20 @@ fn test_one_thousand() {
72
72
  #[test]
73
73
  #[ignore]
74
74
  fn test_one_thousand_two_hundred_thirty_four() {
75
- assert_eq!(say::encode(1234), String::from("one thousand two hundred thirty-four"));
75
+ assert_eq!(
76
+ say::encode(1234),
77
+ String::from("one thousand two hundred thirty-four")
78
+ );
76
79
  }
77
80
 
78
81
  // note, using American style with no and
79
82
  #[test]
80
83
  #[ignore]
81
84
  fn test_eight_hundred_and_ten_thousand() {
82
- assert_eq!(say::encode(810_000), String::from("eight hundred ten thousand"));
85
+ assert_eq!(
86
+ say::encode(810_000),
87
+ String::from("eight hundred ten thousand")
88
+ );
83
89
  }
84
90
 
85
91
  #[test]
@@ -98,8 +104,10 @@ fn test_one_million_two() {
98
104
  #[test]
99
105
  #[ignore]
100
106
  fn test_1002345() {
101
- assert_eq!(say::encode(1_002_345),
102
- String::from("one million two thousand three hundred forty-five"));
107
+ assert_eq!(
108
+ say::encode(1_002_345),
109
+ String::from("one million two thousand three hundred forty-five")
110
+ );
103
111
  }
104
112
 
105
113
  #[test]
@@ -111,11 +119,15 @@ fn test_one_billion() {
111
119
  #[test]
112
120
  #[ignore]
113
121
  fn test_987654321123() {
114
- assert_eq!(say::encode(987_654_321_123),
115
- String::from("nine hundred eighty-seven billion \
116
- six hundred fifty-four million \
117
- three hundred twenty-one thousand \
118
- one hundred twenty-three"));
122
+ assert_eq!(
123
+ say::encode(987_654_321_123),
124
+ String::from(
125
+ "nine hundred eighty-seven billion \
126
+ six hundred fifty-four million \
127
+ three hundred twenty-one thousand \
128
+ one hundred twenty-three"
129
+ )
130
+ );
119
131
  }
120
132
 
121
133
  /*
@@ -124,9 +136,13 @@ fn test_987654321123() {
124
136
  #[test]
125
137
  #[ignore]
126
138
  fn test_max_u64() {
127
- assert_eq!(say::encode(9_223_372_036_854_775_807),
128
- String::from("nine quintillion two hundred twenty-three \
129
- quadrillion three hundred seventy-two trillion \
130
- thirty-six billion eight hundred fifty-four million \
131
- seven hundred seventy-five thousand eight hundred seven"));
139
+ assert_eq!(
140
+ say::encode(9_223_372_036_854_775_807),
141
+ String::from(
142
+ "nine quintillion two hundred twenty-three \
143
+ quadrillion three hundred seventy-two trillion \
144
+ thirty-six billion eight hundred fifty-four million \
145
+ seven hundred seventy-five thousand eight hundred seven"
146
+ )
147
+ );
132
148
  }
@@ -52,11 +52,31 @@ Execute the tests with:
52
52
  $ cargo test
53
53
  ```
54
54
 
55
- All but the first test have been ignored. After you get the first test to
56
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
57
- to pass again. The test file is located in the `tests` directory. You can
58
- also remove the ignore flag from all the tests to get them to run all at once
59
- if you wish.
55
+ All but the first test have been ignored. After you get the first test to
56
+ pass, open the tests source file wich is located in the `tests` directory
57
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
58
+ again. Each separate test is a function with `#[test]` flag above it.
59
+ Continue, until you pass every test.
60
+
61
+ If you wish to run all tests without editing the tests source file, use:
62
+
63
+ ```bash
64
+ $ cargo test -- --ignored
65
+ ```
66
+
67
+ To run a specific test, for example `some_test`, you can use:
68
+
69
+ ```bash
70
+ $ cargo test some_test
71
+ ```
72
+
73
+ If the specfic test is ignored use:
74
+
75
+ ```bash
76
+ $ cargo test some_test -- --ignored
77
+ ```
78
+
79
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
60
80
 
61
81
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
62
82
  haven't already, it will help you with organizing your files.
@@ -70,6 +90,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
70
90
  [help-page]: http://exercism.io/languages/rust
71
91
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
72
92
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
93
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
73
94
 
74
95
  ## Source
75
96
 
@@ -1,4 +1,4 @@
1
1
  /// Compute the Scrabble score for a word.
2
2
  pub fn score(word: &str) -> u64 {
3
3
  unimplemented!("Score {} in Scrabble.", word);
4
- }
4
+ }
@@ -1,18 +1,18 @@
1
1
  # Series
2
2
 
3
3
  Given a string of digits, output all the contiguous substrings of length `n` in
4
- that string.
4
+ that string in the order that they appear.
5
5
 
6
6
  For example, the string "49142" has the following 3-digit series:
7
7
 
8
- - 491
9
- - 914
10
- - 142
8
+ - "491"
9
+ - "914"
10
+ - "142"
11
11
 
12
12
  And the following 4-digit series:
13
13
 
14
- - 4914
15
- - 9142
14
+ - "4914"
15
+ - "9142"
16
16
 
17
17
  And if you ask for a 6-digit series from a 5-digit string, you deserve
18
18
  whatever you get.
@@ -33,11 +33,31 @@ Execute the tests with:
33
33
  $ cargo test
34
34
  ```
35
35
 
36
- All but the first test have been ignored. After you get the first test to
37
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
38
- to pass again. The test file is located in the `tests` directory. You can
39
- also remove the ignore flag from all the tests to get them to run all at once
40
- if you wish.
36
+ All but the first test have been ignored. After you get the first test to
37
+ pass, open the tests source file wich is located in the `tests` directory
38
+ and remove the `#[ignore]` flag from the next test and get the tests to pass
39
+ again. Each separate test is a function with `#[test]` flag above it.
40
+ Continue, until you pass every test.
41
+
42
+ If you wish to run all tests without editing the tests source file, use:
43
+
44
+ ```bash
45
+ $ cargo test -- --ignored
46
+ ```
47
+
48
+ To run a specific test, for example `some_test`, you can use:
49
+
50
+ ```bash
51
+ $ cargo test some_test
52
+ ```
53
+
54
+ If the specfic test is ignored use:
55
+
56
+ ```bash
57
+ $ cargo test some_test -- --ignored
58
+ ```
59
+
60
+ To learn more about Rust tests refer to the [online test documentation][rust-tests]
41
61
 
42
62
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
43
63
  haven't already, it will help you with organizing your files.
@@ -51,6 +71,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
51
71
  [help-page]: http://exercism.io/languages/rust
52
72
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
53
73
  [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
74
+ [rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
54
75
 
55
76
  ## Source
56
77
 
@@ -1,3 +1,7 @@
1
1
  pub fn series(digits: &str, len: usize) -> Vec<String> {
2
- unimplemented!("What are the series of length {} in string {:?}", len, digits)
2
+ unimplemented!(
3
+ "What are the series of length {} in string {:?}",
4
+ len,
5
+ digits
6
+ )
3
7
  }
@@ -5,8 +5,8 @@ number.
5
5
 
6
6
  The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
7
7
  prime numbers up to any given limit. It does so by iteratively marking as
8
- composite (i.e. not prime) the multiples of each prime,
9
- starting with the multiples of 2.
8
+ composite (i.e. not prime) the multiples of each prime, starting with the
9
+ multiples of 2. It does not use any division or remainder operation.
10
10
 
11
11
  Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
12
12
 
@@ -25,7 +25,9 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
25
25
 
26
26
  Notice that this is a very specific algorithm, and the tests don't check
27
27
  that you've implemented the algorithm, only that you've come up with the
28
- correct list of primes.
28
+ correct list of primes. A good first test is to check that you do not use
29
+ division or remainder operations (div, /, mod or % depending on the
30
+ language).
29
31
 
30
32
  ## Rust Installation
31
33
 
@@ -40,11 +42,31 @@ Execute the tests with:
40
42
  $ cargo test
41
43
  ```
42
44
 
43
- All but the first test have been ignored. After you get the first test to
44
- pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
45
- to pass again. The test file is located in the `tests` directory. You can
46
- also remove the ignore flag from all the tests to get them to run all at once
47
- 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]
48
70
 
49
71
  Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
50
72
  haven't already, it will help you with organizing your files.
@@ -58,6 +80,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
58
80
  [help-page]: http://exercism.io/languages/rust
59
81
  [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
60
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
61
84
 
62
85
  ## Source
63
86
 
@@ -17,7 +17,6 @@ fn primes_up_to_10() {
17
17
  assert_eq!(sieve::primes_up_to(10), [2, 3, 5, 7]);
18
18
  }
19
19
 
20
-
21
20
  #[test]
22
21
  #[ignore]
23
22
  fn limit_is_prime() {
@@ -27,16 +26,16 @@ fn limit_is_prime() {
27
26
  #[test]
28
27
  #[ignore]
29
28
  fn limit_of_1000() {
30
- let expected = vec![2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
31
- 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149,
32
- 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
33
- 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
34
- 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
35
- 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
36
- 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
37
- 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691,
38
- 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
39
- 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907,
40
- 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];
29
+ let expected = vec![
30
+ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
31
+ 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,
32
+ 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
33
+ 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
34
+ 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
35
+ 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619,
36
+ 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743,
37
+ 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
38
+ 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
39
+ ];
41
40
  assert_eq!(sieve::primes_up_to(1000), expected);
42
41
  }