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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/go/exercises/dominoes/.meta/gen.go +1 -1
- data/tracks/go/exercises/dominoes/cases_test.go +11 -11
- data/tracks/ocaml/config.json +1 -1
- data/tracks/ocaml/docs/ABOUT.md +6 -4
- data/tracks/powershell/config.json +3 -2
- data/tracks/rust/bin/format_exercises +31 -0
- data/tracks/rust/config.json +10 -2
- data/tracks/rust/config/exercise_readme.go.tmpl +26 -5
- data/tracks/rust/exercises/accumulate/README.md +26 -5
- data/tracks/rust/exercises/accumulate/src/lib.rs +1 -0
- data/tracks/rust/exercises/accumulate/tests/accumulate.rs +7 -7
- data/tracks/rust/exercises/acronym/README.md +26 -5
- data/tracks/rust/exercises/acronym/src/lib.rs +1 -0
- data/tracks/rust/exercises/acronym/tests/acronym.rs +10 -5
- data/tracks/rust/exercises/all-your-base/README.md +26 -5
- data/tracks/rust/exercises/all-your-base/src/lib.rs +6 -1
- data/tracks/rust/exercises/all-your-base/tests/all-your-base.rs +68 -34
- data/tracks/rust/exercises/allergies/README.md +26 -5
- data/tracks/rust/exercises/allergies/src/lib.rs +1 -0
- data/tracks/rust/exercises/allergies/tests/allergies.rs +34 -26
- data/tracks/rust/exercises/alphametics/README.md +26 -5
- data/tracks/rust/exercises/alphametics/tests/alphametics.rs +44 -9
- data/tracks/rust/exercises/anagram/README.md +26 -5
- data/tracks/rust/exercises/anagram/src/lib.rs +1 -0
- data/tracks/rust/exercises/anagram/tests/anagram.rs +15 -4
- data/tracks/rust/exercises/armstrong-numbers/README.md +26 -5
- data/tracks/rust/exercises/atbash-cipher/README.md +26 -5
- data/tracks/rust/exercises/atbash-cipher/src/lib.rs +1 -1
- data/tracks/rust/exercises/atbash-cipher/tests/atbash-cipher.rs +16 -8
- data/tracks/rust/exercises/beer-song/README.md +26 -5
- data/tracks/rust/exercises/binary-search/README.md +26 -5
- data/tracks/rust/exercises/binary-search/src/lib.rs +1 -0
- data/tracks/rust/exercises/binary-search/tests/binary-search.rs +8 -4
- data/tracks/rust/exercises/bob/README.md +26 -5
- data/tracks/rust/exercises/bob/tests/bob.rs +32 -15
- data/tracks/rust/exercises/book-store/README.md +26 -5
- data/tracks/rust/exercises/book-store/src/lib.rs +4 -1
- data/tracks/rust/exercises/book-store/tests/book-store.rs +52 -24
- data/tracks/rust/exercises/bowling/README.md +26 -5
- data/tracks/rust/exercises/bowling/src/lib.rs +1 -2
- data/tracks/rust/exercises/bowling/tests/bowling.rs +2 -1
- data/tracks/rust/exercises/bracket-push/README.md +29 -7
- data/tracks/rust/exercises/bracket-push/src/lib.rs +1 -0
- data/tracks/rust/exercises/circular-buffer/README.md +26 -5
- data/tracks/rust/exercises/circular-buffer/src/lib.rs +1 -0
- data/tracks/rust/exercises/clock/README.md +26 -5
- data/tracks/rust/exercises/clock/src/lib.rs +1 -0
- data/tracks/rust/exercises/clock/tests/clock.rs +0 -1
- data/tracks/rust/exercises/collatz-conjecture/README.md +26 -5
- data/tracks/rust/exercises/crypto-square/README.md +53 -29
- data/tracks/rust/exercises/custom-set/README.md +26 -5
- data/tracks/rust/exercises/custom-set/src/lib.rs +1 -0
- data/tracks/rust/exercises/decimal/README.md +26 -5
- data/tracks/rust/exercises/decimal/tests/decimal.rs +4 -7
- data/tracks/rust/exercises/diamond/README.md +26 -5
- data/tracks/rust/exercises/difference-of-squares/README.md +26 -5
- data/tracks/rust/exercises/difference-of-squares/src/lib.rs +1 -1
- data/tracks/rust/exercises/diffie-hellman/README.md +26 -5
- data/tracks/rust/exercises/diffie-hellman/src/lib.rs +12 -2
- data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +3 -3
- data/tracks/rust/exercises/dominoes/README.md +26 -5
- data/tracks/rust/exercises/dominoes/src/lib.rs +1 -0
- data/tracks/rust/exercises/dominoes/tests/dominoes.rs +29 -13
- data/tracks/rust/exercises/etl/README.md +26 -5
- data/tracks/rust/exercises/etl/src/lib.rs +1 -0
- data/tracks/rust/exercises/etl/tests/etl.rs +39 -34
- data/tracks/rust/exercises/forth/README.md +26 -5
- data/tracks/rust/exercises/forth/tests/forth.rs +17 -65
- data/tracks/rust/exercises/gigasecond/README.md +26 -5
- data/tracks/rust/exercises/gigasecond/tests/gigasecond.rs +31 -10
- data/tracks/rust/exercises/grade-school/README.md +26 -5
- data/tracks/rust/exercises/grade-school/src/lib.rs +1 -2
- data/tracks/rust/exercises/grade-school/tests/grade-school.rs +5 -9
- data/tracks/rust/exercises/grains/README.md +26 -5
- data/tracks/rust/exercises/hamming/README.md +30 -8
- data/tracks/rust/exercises/hamming/src/lib.rs +1 -2
- data/tracks/rust/exercises/hello-world/README.md +26 -5
- data/tracks/rust/exercises/hexadecimal/README.md +26 -5
- data/tracks/rust/exercises/hexadecimal/src/lib.rs +1 -0
- data/tracks/rust/exercises/isbn-verifier/README.md +26 -5
- data/tracks/rust/exercises/isogram/README.md +26 -5
- data/tracks/rust/exercises/isogram/src/lib.rs +1 -1
- data/tracks/rust/exercises/isogram/tests/isogram.rs +36 -24
- data/tracks/rust/exercises/largest-series-product/README.md +26 -5
- data/tracks/rust/exercises/largest-series-product/src/lib.rs +5 -1
- data/tracks/rust/exercises/largest-series-product/tests/largest-series-product.rs +4 -2
- data/tracks/rust/exercises/leap/README.md +26 -5
- data/tracks/rust/exercises/luhn-from/README.md +26 -5
- data/tracks/rust/exercises/luhn-from/src/lib.rs +1 -0
- data/tracks/rust/exercises/luhn-trait/README.md +26 -5
- data/tracks/rust/exercises/luhn-trait/src/lib.rs +1 -0
- data/tracks/rust/exercises/luhn/README.md +26 -5
- data/tracks/rust/exercises/luhn/src/lib.rs +1 -1
- data/tracks/rust/exercises/macros/README.md +26 -5
- data/tracks/rust/exercises/minesweeper/README.md +26 -5
- data/tracks/rust/exercises/minesweeper/src/lib.rs +1 -0
- data/tracks/rust/exercises/nth-prime/README.md +26 -5
- data/tracks/rust/exercises/nucleotide-codons/README.md +26 -5
- data/tracks/rust/exercises/nucleotide-codons/src/lib.rs +1 -0
- data/tracks/rust/exercises/nucleotide-codons/tests/codons.rs +6 -5
- data/tracks/rust/exercises/nucleotide-count/README.md +26 -5
- data/tracks/rust/exercises/nucleotide-count/src/lib.rs +1 -0
- data/tracks/rust/exercises/nucleotide-count/tests/nucleotide-count.rs +5 -8
- data/tracks/rust/exercises/ocr-numbers/README.md +26 -5
- data/tracks/rust/exercises/ocr-numbers/tests/ocr-numbers.rs +0 -1
- data/tracks/rust/exercises/palindrome-products/README.md +26 -5
- data/tracks/rust/exercises/pangram/README.md +26 -5
- data/tracks/rust/exercises/pangram/src/lib.rs +1 -1
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +26 -5
- data/tracks/rust/exercises/parallel-letter-frequency/benches/benchmark.rs +6 -3
- data/tracks/rust/exercises/parallel-letter-frequency/src/lib.rs +1 -0
- data/tracks/rust/exercises/parallel-letter-frequency/tests/parallel-letter-frequency.rs +6 -3
- data/tracks/rust/exercises/pascals-triangle/README.md +26 -5
- data/tracks/rust/exercises/pascals-triangle/tests/pascals-triangle.rs +36 -28
- data/tracks/rust/exercises/perfect-numbers/README.md +26 -5
- data/tracks/rust/exercises/perfect-numbers/src/lib.rs +1 -1
- data/tracks/rust/exercises/perfect-numbers/tests/perfect-numbers.rs +1 -2
- data/tracks/rust/exercises/phone-number/README.md +26 -5
- data/tracks/rust/exercises/phone-number/src/lib.rs +1 -0
- data/tracks/rust/exercises/pig-latin/README.md +26 -5
- data/tracks/rust/exercises/pig-latin/src/lib.rs +1 -0
- data/tracks/rust/exercises/poker/README.md +26 -5
- data/tracks/rust/exercises/poker/tests/poker.rs +27 -104
- data/tracks/rust/exercises/prime-factors/README.md +26 -5
- data/tracks/rust/exercises/protein-translation/README.md +26 -5
- data/tracks/rust/exercises/protein-translation/src/lib.rs +1 -0
- data/tracks/rust/exercises/protein-translation/tests/proteins.rs +16 -9
- data/tracks/rust/exercises/proverb/README.md +26 -5
- data/tracks/rust/exercises/proverb/tests/proverb.rs +1 -7
- data/tracks/rust/exercises/pythagorean-triplet/README.md +26 -5
- data/tracks/rust/exercises/queen-attack/README.md +26 -5
- data/tracks/rust/exercises/queen-attack/src/lib.rs +1 -0
- data/tracks/rust/exercises/raindrops/README.md +26 -5
- data/tracks/rust/exercises/raindrops/tests/raindrops.rs +57 -19
- data/tracks/rust/exercises/react/README.md +26 -5
- data/tracks/rust/exercises/react/src/lib.rs +16 -4
- data/tracks/rust/exercises/react/tests/react.rs +174 -43
- data/tracks/rust/exercises/rectangles/README.md +26 -5
- data/tracks/rust/exercises/rectangles/src/lib.rs +1 -0
- data/tracks/rust/exercises/reverse-string/README.md +26 -5
- data/tracks/rust/exercises/reverse-string/tests/reverse-string.rs +2 -11
- data/tracks/rust/exercises/rna-transcription/README.md +26 -5
- data/tracks/rust/exercises/rna-transcription/src/lib.rs +1 -0
- data/tracks/rust/exercises/robot-name/README.md +26 -5
- data/tracks/rust/exercises/robot-name/src/lib.rs +1 -0
- data/tracks/rust/exercises/robot-name/tests/robot-name.rs +8 -2
- data/tracks/rust/exercises/robot-simulator/README.md +26 -5
- data/tracks/rust/exercises/robot-simulator/src/lib.rs +5 -6
- data/tracks/rust/exercises/roman-numerals/README.md +26 -5
- data/tracks/rust/exercises/roman-numerals/src/lib.rs +1 -0
- data/tracks/rust/exercises/rotational-cipher/README.md +26 -5
- data/tracks/rust/exercises/rotational-cipher/src/lib.rs +1 -0
- data/tracks/rust/exercises/rotational-cipher/tests/rotational-cipher.rs +12 -4
- data/tracks/rust/exercises/run-length-encoding/README.md +26 -5
- data/tracks/rust/exercises/run-length-encoding/src/lib.rs +1 -1
- data/tracks/rust/exercises/run-length-encoding/tests/run-length-encoding.rs +12 -5
- data/tracks/rust/exercises/saddle-points/README.md +26 -5
- data/tracks/rust/exercises/saddle-points/src/lib.rs +4 -1
- data/tracks/rust/exercises/say/README.md +27 -6
- data/tracks/rust/exercises/say/src/lib.rs +1 -1
- data/tracks/rust/exercises/say/tests/say.rs +30 -14
- data/tracks/rust/exercises/scrabble-score/README.md +26 -5
- data/tracks/rust/exercises/scrabble-score/src/lib.rs +1 -1
- data/tracks/rust/exercises/series/README.md +32 -11
- data/tracks/rust/exercises/series/src/lib.rs +5 -1
- data/tracks/rust/exercises/sieve/README.md +31 -8
- data/tracks/rust/exercises/sieve/src/lib.rs +1 -0
- data/tracks/rust/exercises/sieve/tests/sieve.rs +11 -12
- data/tracks/rust/exercises/simple-cipher/README.md +26 -5
- data/tracks/rust/exercises/simple-cipher/src/lib.rs +6 -3
- data/tracks/rust/exercises/simple-cipher/tests/simple-cipher.rs +0 -1
- data/tracks/rust/exercises/simple-linked-list/README.md +26 -5
- data/tracks/rust/exercises/simple-linked-list/src/lib.rs +0 -1
- data/tracks/rust/exercises/simple-linked-list/tests/simple-linked-list.rs +0 -1
- data/tracks/rust/exercises/space-age/README.md +26 -5
- data/tracks/rust/exercises/space-age/tests/space-age.rs +4 -4
- data/tracks/rust/exercises/spiral-matrix/README.md +26 -5
- data/tracks/rust/exercises/sublist/README.md +26 -5
- data/tracks/rust/exercises/sublist/src/lib.rs +1 -0
- data/tracks/rust/exercises/sublist/tests/sublist.rs +17 -68
- data/tracks/rust/exercises/sum-of-multiples/README.md +26 -5
- data/tracks/rust/exercises/sum-of-multiples/src/lib.rs +5 -1
- data/tracks/rust/exercises/tournament/README.md +26 -5
- data/tracks/rust/exercises/tournament/src/lib.rs +1 -0
- data/tracks/rust/exercises/tournament/tests/tournament.rs +60 -60
- data/tracks/rust/exercises/triangle/README.md +26 -5
- data/tracks/rust/exercises/triangle/src/lib.rs +1 -0
- data/tracks/rust/exercises/two-bucket/README.md +26 -5
- data/tracks/rust/exercises/two-bucket/src/lib.rs +2 -6
- data/tracks/rust/exercises/two-bucket/tests/two-bucket.rs +49 -37
- data/tracks/rust/exercises/twofer/README.md +33 -7
- data/tracks/rust/exercises/twofer/src/lib.rs +2 -2
- data/tracks/rust/exercises/twofer/tests/two-fer.rs +2 -2
- data/tracks/rust/exercises/variable-length-quantity/README.md +26 -5
- data/tracks/rust/exercises/variable-length-quantity/tests/variable-length-quantity.rs +60 -32
- data/tracks/rust/exercises/word-count/README.md +26 -5
- data/tracks/rust/exercises/word-count/src/lib.rs +1 -1
- data/tracks/rust/exercises/word-count/tests/word-count.rs +15 -23
- data/tracks/rust/exercises/wordy/README.md +26 -5
- data/tracks/rust/exercises/wordy/src/lib.rs +1 -0
- metadata +3 -2
@@ -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!(
|
26
|
-
"
|
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!(
|
65
|
-
|
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!(
|
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.
|
43
|
-
pass,
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
|
@@ -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.
|
100
|
-
pass,
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
|
@@ -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!(
|
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!(
|
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!(
|
102
|
-
|
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!(
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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!(
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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.
|
56
|
-
pass,
|
57
|
-
|
58
|
-
|
59
|
-
|
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,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.
|
37
|
-
pass,
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
|
@@ -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
|
-
|
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.
|
44
|
-
pass,
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -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![
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
}
|