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
@@ -94,11 +94,31 @@ Execute the tests with:
|
|
94
94
|
$ cargo test
|
95
95
|
```
|
96
96
|
|
97
|
-
All but the first test have been ignored.
|
98
|
-
pass,
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
All but the first test have been ignored. After you get the first test to
|
98
|
+
pass, open the tests source file wich is located in the `tests` directory
|
99
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
100
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
101
|
+
Continue, until you pass every test.
|
102
|
+
|
103
|
+
If you wish to run all tests without editing the tests source file, use:
|
104
|
+
|
105
|
+
```bash
|
106
|
+
$ cargo test -- --ignored
|
107
|
+
```
|
108
|
+
|
109
|
+
To run a specific test, for example `some_test`, you can use:
|
110
|
+
|
111
|
+
```bash
|
112
|
+
$ cargo test some_test
|
113
|
+
```
|
114
|
+
|
115
|
+
If the specfic test is ignored use:
|
116
|
+
|
117
|
+
```bash
|
118
|
+
$ cargo test some_test -- --ignored
|
119
|
+
```
|
120
|
+
|
121
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
102
122
|
|
103
123
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
104
124
|
haven't already, it will help you with organizing your files.
|
@@ -112,6 +132,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
112
132
|
[help-page]: http://exercism.io/languages/rust
|
113
133
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
114
134
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
135
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
115
136
|
|
116
137
|
## Source
|
117
138
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
pub fn encode(key: &str, s: &str) -> Option<String> {
|
2
|
-
unimplemented!("Use {} to encode {} using shift cipher",key,s)
|
2
|
+
unimplemented!("Use {} to encode {} using shift cipher", key, s)
|
3
3
|
}
|
4
4
|
|
5
5
|
pub fn decode(key: &str, s: &str) -> Option<String> {
|
6
|
-
unimplemented!("Use {} to decode {} using shift cipher",key,s)
|
6
|
+
unimplemented!("Use {} to decode {} using shift cipher", key, s)
|
7
7
|
}
|
8
8
|
|
9
9
|
pub fn encode_random(s: &str) -> (String, String) {
|
10
|
-
unimplemented!(
|
10
|
+
unimplemented!(
|
11
|
+
"Generate random key with only a-z chars and encode {}. Return tuple (key, encoded s)",
|
12
|
+
s
|
13
|
+
)
|
11
14
|
}
|
@@ -69,11 +69,31 @@ Execute the tests with:
|
|
69
69
|
$ cargo test
|
70
70
|
```
|
71
71
|
|
72
|
-
All but the first test have been ignored.
|
73
|
-
pass,
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
All but the first test have been ignored. After you get the first test to
|
73
|
+
pass, open the tests source file wich is located in the `tests` directory
|
74
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
75
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
76
|
+
Continue, until you pass every test.
|
77
|
+
|
78
|
+
If you wish to run all tests without editing the tests source file, use:
|
79
|
+
|
80
|
+
```bash
|
81
|
+
$ cargo test -- --ignored
|
82
|
+
```
|
83
|
+
|
84
|
+
To run a specific test, for example `some_test`, you can use:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
$ cargo test some_test
|
88
|
+
```
|
89
|
+
|
90
|
+
If the specfic test is ignored use:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
$ cargo test some_test -- --ignored
|
94
|
+
```
|
95
|
+
|
96
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
77
97
|
|
78
98
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
79
99
|
haven't already, it will help you with organizing your files.
|
@@ -87,6 +107,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
87
107
|
[help-page]: http://exercism.io/languages/rust
|
88
108
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
89
109
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
110
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
90
111
|
|
91
112
|
## Source
|
92
113
|
|
@@ -38,11 +38,31 @@ Execute the tests with:
|
|
38
38
|
$ cargo test
|
39
39
|
```
|
40
40
|
|
41
|
-
All but the first test have been ignored.
|
42
|
-
pass,
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
All but the first test have been ignored. After you get the first test to
|
42
|
+
pass, open the tests source file wich is located in the `tests` directory
|
43
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
44
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
45
|
+
Continue, until you pass every test.
|
46
|
+
|
47
|
+
If you wish to run all tests without editing the tests source file, use:
|
48
|
+
|
49
|
+
```bash
|
50
|
+
$ cargo test -- --ignored
|
51
|
+
```
|
52
|
+
|
53
|
+
To run a specific test, for example `some_test`, you can use:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
$ cargo test some_test
|
57
|
+
```
|
58
|
+
|
59
|
+
If the specfic test is ignored use:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
$ cargo test some_test -- --ignored
|
63
|
+
```
|
64
|
+
|
65
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
46
66
|
|
47
67
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
48
68
|
haven't already, it will help you with organizing your files.
|
@@ -56,6 +76,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
56
76
|
[help-page]: http://exercism.io/languages/rust
|
57
77
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
58
78
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
79
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
59
80
|
|
60
81
|
## Source
|
61
82
|
|
@@ -6,10 +6,10 @@ fn assert_in_delta(expected: f64, actual: f64) {
|
|
6
6
|
let diff: f64 = (expected - actual).abs();
|
7
7
|
let delta: f64 = 0.01;
|
8
8
|
if diff > delta {
|
9
|
-
panic!(
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
panic!(
|
10
|
+
"Your result of {} should be within {} of the expected result {}",
|
11
|
+
actual, delta, expected
|
12
|
+
)
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
@@ -36,11 +36,31 @@ Execute the tests with:
|
|
36
36
|
$ cargo test
|
37
37
|
```
|
38
38
|
|
39
|
-
All but the first test have been ignored.
|
40
|
-
pass,
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
All but the first test have been ignored. After you get the first test to
|
40
|
+
pass, open the tests source file wich is located in the `tests` directory
|
41
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
42
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
43
|
+
Continue, until you pass every test.
|
44
|
+
|
45
|
+
If you wish to run all tests without editing the tests source file, use:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ cargo test -- --ignored
|
49
|
+
```
|
50
|
+
|
51
|
+
To run a specific test, for example `some_test`, you can use:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$ cargo test some_test
|
55
|
+
```
|
56
|
+
|
57
|
+
If the specfic test is ignored use:
|
58
|
+
|
59
|
+
```bash
|
60
|
+
$ cargo test some_test -- --ignored
|
61
|
+
```
|
62
|
+
|
63
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
44
64
|
|
45
65
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
46
66
|
haven't already, it will help you with organizing your files.
|
@@ -54,6 +74,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
54
74
|
[help-page]: http://exercism.io/languages/rust
|
55
75
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
56
76
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
77
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
57
78
|
|
58
79
|
## Source
|
59
80
|
|
@@ -30,11 +30,31 @@ Execute the tests with:
|
|
30
30
|
$ cargo test
|
31
31
|
```
|
32
32
|
|
33
|
-
All but the first test have been ignored.
|
34
|
-
pass,
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
All but the first test have been ignored. After you get the first test to
|
34
|
+
pass, open the tests source file wich is located in the `tests` directory
|
35
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
36
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
37
|
+
Continue, until you pass every test.
|
38
|
+
|
39
|
+
If you wish to run all tests without editing the tests source file, use:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
$ cargo test -- --ignored
|
43
|
+
```
|
44
|
+
|
45
|
+
To run a specific test, for example `some_test`, you can use:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ cargo test some_test
|
49
|
+
```
|
50
|
+
|
51
|
+
If the specfic test is ignored use:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$ cargo test some_test -- --ignored
|
55
|
+
```
|
56
|
+
|
57
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
38
58
|
|
39
59
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
40
60
|
haven't already, it will help you with organizing your files.
|
@@ -48,6 +68,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
48
68
|
[help-page]: http://exercism.io/languages/rust
|
49
69
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
50
70
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
71
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
51
72
|
|
52
73
|
## Submitting Incomplete Solutions
|
53
74
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -6,37 +6,25 @@ use sublist::{sublist, Comparison};
|
|
6
6
|
fn empty_equals_empty() {
|
7
7
|
let v: &[u32] = &[];
|
8
8
|
|
9
|
-
assert_eq!(
|
10
|
-
Comparison::Equal,
|
11
|
-
sublist(&v, &v)
|
12
|
-
);
|
9
|
+
assert_eq!(Comparison::Equal, sublist(&v, &v));
|
13
10
|
}
|
14
11
|
|
15
12
|
#[test]
|
16
13
|
#[ignore]
|
17
14
|
fn test_empty_is_a_sublist_of_anything() {
|
18
|
-
assert_eq!(
|
19
|
-
Comparison::Sublist,
|
20
|
-
sublist(&[], &['a', 's', 'd', 'f'])
|
21
|
-
);
|
15
|
+
assert_eq!(Comparison::Sublist, sublist(&[], &['a', 's', 'd', 'f']));
|
22
16
|
}
|
23
17
|
|
24
18
|
#[test]
|
25
19
|
#[ignore]
|
26
20
|
fn test_anything_is_a_superlist_of_empty() {
|
27
|
-
assert_eq!(
|
28
|
-
Comparison::Superlist,
|
29
|
-
sublist(&['a', 's', 'd', 'f'], &[])
|
30
|
-
);
|
21
|
+
assert_eq!(Comparison::Superlist, sublist(&['a', 's', 'd', 'f'], &[]));
|
31
22
|
}
|
32
23
|
|
33
24
|
#[test]
|
34
25
|
#[ignore]
|
35
26
|
fn test_1_is_not_2() {
|
36
|
-
assert_eq!(
|
37
|
-
Comparison::Unequal,
|
38
|
-
sublist(&[1], &[2])
|
39
|
-
);
|
27
|
+
assert_eq!(Comparison::Unequal, sublist(&[1], &[2]));
|
40
28
|
}
|
41
29
|
|
42
30
|
#[test]
|
@@ -46,46 +34,31 @@ fn test_compare_larger_equal_lists() {
|
|
46
34
|
|
47
35
|
let v: Vec<char> = repeat('x').take(1000).collect();
|
48
36
|
|
49
|
-
assert_eq!(
|
50
|
-
Comparison::Equal,
|
51
|
-
sublist(&v, &v)
|
52
|
-
);
|
37
|
+
assert_eq!(Comparison::Equal, sublist(&v, &v));
|
53
38
|
}
|
54
39
|
|
55
40
|
#[test]
|
56
41
|
#[ignore]
|
57
42
|
fn test_sublist_at_start() {
|
58
|
-
assert_eq!(
|
59
|
-
Comparison::Sublist,
|
60
|
-
sublist(&[1, 2, 3], &[1, 2, 3, 4, 5])
|
61
|
-
);
|
43
|
+
assert_eq!(Comparison::Sublist, sublist(&[1, 2, 3], &[1, 2, 3, 4, 5]));
|
62
44
|
}
|
63
45
|
|
64
46
|
#[test]
|
65
47
|
#[ignore]
|
66
48
|
fn sublist_in_middle() {
|
67
|
-
assert_eq!(
|
68
|
-
Comparison::Sublist,
|
69
|
-
sublist(&[4, 3, 2], &[5, 4, 3, 2, 1])
|
70
|
-
);
|
49
|
+
assert_eq!(Comparison::Sublist, sublist(&[4, 3, 2], &[5, 4, 3, 2, 1]));
|
71
50
|
}
|
72
51
|
|
73
52
|
#[test]
|
74
53
|
#[ignore]
|
75
54
|
fn sublist_at_end() {
|
76
|
-
assert_eq!(
|
77
|
-
Comparison::Sublist,
|
78
|
-
sublist(&[3, 4, 5], &[1, 2, 3, 4, 5])
|
79
|
-
);
|
55
|
+
assert_eq!(Comparison::Sublist, sublist(&[3, 4, 5], &[1, 2, 3, 4, 5]));
|
80
56
|
}
|
81
57
|
|
82
58
|
#[test]
|
83
59
|
#[ignore]
|
84
60
|
fn partially_matching_sublist_at_start() {
|
85
|
-
assert_eq!(
|
86
|
-
Comparison::Sublist,
|
87
|
-
sublist(&[1, 1, 2], &[1, 1, 1, 2])
|
88
|
-
);
|
61
|
+
assert_eq!(Comparison::Sublist, sublist(&[1, 1, 2], &[1, 1, 1, 2]));
|
89
62
|
}
|
90
63
|
|
91
64
|
#[test]
|
@@ -93,10 +66,7 @@ fn partially_matching_sublist_at_start() {
|
|
93
66
|
fn sublist_early_in_huge_list() {
|
94
67
|
let huge: Vec<u32> = (1..1000000).collect();
|
95
68
|
|
96
|
-
assert_eq!(
|
97
|
-
Comparison::Sublist,
|
98
|
-
sublist(&[3, 4, 5], &huge)
|
99
|
-
);
|
69
|
+
assert_eq!(Comparison::Sublist, sublist(&[3, 4, 5], &huge));
|
100
70
|
}
|
101
71
|
|
102
72
|
#[test]
|
@@ -105,37 +75,25 @@ fn huge_sublist_not_in_huge_list() {
|
|
105
75
|
let v1: Vec<u64> = (10..1000001).collect();
|
106
76
|
let v2: Vec<u64> = (1..1000000).collect();
|
107
77
|
|
108
|
-
assert_eq!(
|
109
|
-
Comparison::Unequal,
|
110
|
-
sublist(&v1, &v2)
|
111
|
-
);
|
78
|
+
assert_eq!(Comparison::Unequal, sublist(&v1, &v2));
|
112
79
|
}
|
113
80
|
|
114
81
|
#[test]
|
115
82
|
#[ignore]
|
116
83
|
fn superlist_at_start() {
|
117
|
-
assert_eq!(
|
118
|
-
Comparison::Superlist,
|
119
|
-
sublist(&[1, 2, 3, 4, 5], &[1, 2, 3])
|
120
|
-
);
|
84
|
+
assert_eq!(Comparison::Superlist, sublist(&[1, 2, 3, 4, 5], &[1, 2, 3]));
|
121
85
|
}
|
122
86
|
|
123
87
|
#[test]
|
124
88
|
#[ignore]
|
125
89
|
fn superlist_in_middle() {
|
126
|
-
assert_eq!(
|
127
|
-
Comparison::Superlist,
|
128
|
-
sublist(&[5, 4, 3, 2, 1], &[4, 3, 2])
|
129
|
-
);
|
90
|
+
assert_eq!(Comparison::Superlist, sublist(&[5, 4, 3, 2, 1], &[4, 3, 2]));
|
130
91
|
}
|
131
92
|
|
132
93
|
#[test]
|
133
94
|
#[ignore]
|
134
95
|
fn superlist_at_end() {
|
135
|
-
assert_eq!(
|
136
|
-
Comparison::Superlist,
|
137
|
-
sublist(&[1, 2, 3, 4, 5], &[3, 4, 5])
|
138
|
-
);
|
96
|
+
assert_eq!(Comparison::Superlist, sublist(&[1, 2, 3, 4, 5], &[3, 4, 5]));
|
139
97
|
}
|
140
98
|
|
141
99
|
#[test]
|
@@ -143,10 +101,7 @@ fn superlist_at_end() {
|
|
143
101
|
fn superlist_early_in_huge_list() {
|
144
102
|
let huge: Vec<u32> = (1..1000000).collect();
|
145
103
|
|
146
|
-
assert_eq!(
|
147
|
-
Comparison::Superlist,
|
148
|
-
sublist(&huge, &[3, 4, 5])
|
149
|
-
);
|
104
|
+
assert_eq!(Comparison::Superlist, sublist(&huge, &[3, 4, 5]));
|
150
105
|
}
|
151
106
|
|
152
107
|
#[test]
|
@@ -154,10 +109,7 @@ fn superlist_early_in_huge_list() {
|
|
154
109
|
fn recurring_values_sublist() {
|
155
110
|
assert_eq!(
|
156
111
|
Comparison::Sublist,
|
157
|
-
sublist(
|
158
|
-
&[1, 2, 1, 2, 3],
|
159
|
-
&[1, 2, 3, 1, 2, 1, 2, 3, 2, 1]
|
160
|
-
)
|
112
|
+
sublist(&[1, 2, 1, 2, 3], &[1, 2, 3, 1, 2, 1, 2, 3, 2, 1])
|
161
113
|
);
|
162
114
|
}
|
163
115
|
|
@@ -166,9 +118,6 @@ fn recurring_values_sublist() {
|
|
166
118
|
fn recurring_values_unequal() {
|
167
119
|
assert_eq!(
|
168
120
|
Comparison::Unequal,
|
169
|
-
sublist(
|
170
|
-
&[1, 2, 1, 2, 3],
|
171
|
-
&[1, 2, 3, 1, 2, 3, 2, 3, 2, 1]
|
172
|
-
)
|
121
|
+
sublist(&[1, 2, 1, 2, 3], &[1, 2, 3, 1, 2, 3, 2, 3, 2, 1])
|
173
122
|
);
|
174
123
|
}
|