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
@@ -20,11 +20,31 @@ Execute the tests with:
|
|
20
20
|
$ cargo test
|
21
21
|
```
|
22
22
|
|
23
|
-
All but the first test have been ignored.
|
24
|
-
pass,
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
All but the first test have been ignored. After you get the first test to
|
24
|
+
pass, open the tests source file wich is located in the `tests` directory
|
25
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
26
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
27
|
+
Continue, until you pass every test.
|
28
|
+
|
29
|
+
If you wish to run all tests without editing the tests source file, use:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ cargo test -- --ignored
|
33
|
+
```
|
34
|
+
|
35
|
+
To run a specific test, for example `some_test`, you can use:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
$ cargo test some_test
|
39
|
+
```
|
40
|
+
|
41
|
+
If the specfic test is ignored use:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
$ cargo test some_test -- --ignored
|
45
|
+
```
|
46
|
+
|
47
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
28
48
|
|
29
49
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
30
50
|
haven't already, it will help you with organizing your files.
|
@@ -38,6 +58,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
38
58
|
[help-page]: http://exercism.io/languages/rust
|
39
59
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
40
60
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
61
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
41
62
|
|
42
63
|
## Source
|
43
64
|
|
@@ -12,39 +12,60 @@ extern crate gigasecond;
|
|
12
12
|
*
|
13
13
|
* In order to use the crate, your solution will need to start with the two following lines
|
14
14
|
*/
|
15
|
+
|
15
16
|
extern crate chrono;
|
16
17
|
use chrono::{TimeZone, Utc};
|
17
18
|
|
18
19
|
#[test]
|
19
20
|
fn test_date() {
|
20
|
-
let start_date = Utc.ymd(2011, 4, 25).and_hms(0,0,0);
|
21
|
-
|
21
|
+
let start_date = Utc.ymd(2011, 4, 25).and_hms(0, 0, 0);
|
22
|
+
|
23
|
+
assert_eq!(
|
24
|
+
gigasecond::after(start_date),
|
25
|
+
Utc.ymd(2043, 1, 1).and_hms(1, 46, 40)
|
26
|
+
);
|
22
27
|
}
|
23
28
|
|
24
29
|
#[test]
|
25
30
|
#[ignore]
|
26
31
|
fn test_another_date() {
|
27
|
-
let start_date = Utc.ymd(1977, 6, 13).and_hms(0,0,0);
|
28
|
-
|
32
|
+
let start_date = Utc.ymd(1977, 6, 13).and_hms(0, 0, 0);
|
33
|
+
|
34
|
+
assert_eq!(
|
35
|
+
gigasecond::after(start_date),
|
36
|
+
Utc.ymd(2009, 2, 19).and_hms(1, 46, 40)
|
37
|
+
);
|
29
38
|
}
|
30
39
|
|
31
40
|
#[test]
|
32
41
|
#[ignore]
|
33
42
|
fn test_third_date() {
|
34
|
-
let start_date = Utc.ymd(1959, 7, 19).and_hms(0,0,0);
|
35
|
-
|
43
|
+
let start_date = Utc.ymd(1959, 7, 19).and_hms(0, 0, 0);
|
44
|
+
|
45
|
+
assert_eq!(
|
46
|
+
gigasecond::after(start_date),
|
47
|
+
Utc.ymd(1991, 3, 27).and_hms(1, 46, 40)
|
48
|
+
);
|
36
49
|
}
|
37
50
|
|
38
51
|
#[test]
|
39
52
|
#[ignore]
|
40
53
|
fn test_datetime() {
|
41
|
-
let start_date = Utc.ymd(2015, 1, 24).and_hms(22,0,0);
|
42
|
-
|
54
|
+
let start_date = Utc.ymd(2015, 1, 24).and_hms(22, 0, 0);
|
55
|
+
|
56
|
+
assert_eq!(
|
57
|
+
gigasecond::after(start_date),
|
58
|
+
Utc.ymd(2046, 10, 2).and_hms(23, 46, 40)
|
59
|
+
);
|
43
60
|
}
|
44
61
|
|
45
62
|
#[test]
|
46
63
|
#[ignore]
|
47
64
|
fn test_another_datetime() {
|
48
|
-
let start_date = Utc.ymd(2015, 1, 24).and_hms(23,59,59);
|
49
|
-
|
65
|
+
let start_date = Utc.ymd(2015, 1, 24).and_hms(23, 59, 59);
|
66
|
+
|
67
|
+
assert_eq!(
|
68
|
+
gigasecond::after(start_date),
|
69
|
+
Utc.ymd(2046, 10, 3).and_hms(1, 46, 39)
|
70
|
+
);
|
50
71
|
}
|
@@ -47,11 +47,31 @@ Execute the tests with:
|
|
47
47
|
$ cargo test
|
48
48
|
```
|
49
49
|
|
50
|
-
All but the first test have been ignored.
|
51
|
-
pass,
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
All but the first test have been ignored. After you get the first test to
|
51
|
+
pass, open the tests source file wich is located in the `tests` directory
|
52
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
53
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
54
|
+
Continue, until you pass every test.
|
55
|
+
|
56
|
+
If you wish to run all tests without editing the tests source file, use:
|
57
|
+
|
58
|
+
```bash
|
59
|
+
$ cargo test -- --ignored
|
60
|
+
```
|
61
|
+
|
62
|
+
To run a specific test, for example `some_test`, you can use:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
$ cargo test some_test
|
66
|
+
```
|
67
|
+
|
68
|
+
If the specfic test is ignored use:
|
69
|
+
|
70
|
+
```bash
|
71
|
+
$ cargo test some_test -- --ignored
|
72
|
+
```
|
73
|
+
|
74
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
55
75
|
|
56
76
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
57
77
|
haven't already, it will help you with organizing your files.
|
@@ -65,6 +85,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
65
85
|
[help-page]: http://exercism.io/languages/rust
|
66
86
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
67
87
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
88
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
68
89
|
|
69
90
|
## Source
|
70
91
|
|
@@ -58,8 +58,7 @@ fn test_grade_when_no_students_have_that_grade() {
|
|
58
58
|
fn test_grade_for_one_student() {
|
59
59
|
let mut s = school::School::new();
|
60
60
|
s.add(2, "Aimee");
|
61
|
-
assert_eq!(s.grade(2),
|
62
|
-
some_strings(&["Aimee"]));
|
61
|
+
assert_eq!(s.grade(2), some_strings(&["Aimee"]));
|
63
62
|
}
|
64
63
|
|
65
64
|
#[test]
|
@@ -69,8 +68,7 @@ fn test_grade_returns_students_sorted_by_name() {
|
|
69
68
|
s.add(2, "James");
|
70
69
|
s.add(2, "Blair");
|
71
70
|
s.add(2, "Paul");
|
72
|
-
assert_eq!(s.grade(2),
|
73
|
-
some_strings(&["Blair", "James", "Paul"]));
|
71
|
+
assert_eq!(s.grade(2), some_strings(&["Blair", "James", "Paul"]));
|
74
72
|
}
|
75
73
|
|
76
74
|
#[test]
|
@@ -79,9 +77,7 @@ fn test_add_students_to_different_grades() {
|
|
79
77
|
let mut s = school::School::new();
|
80
78
|
s.add(3, "Chelsea");
|
81
79
|
s.add(7, "Logan");
|
82
|
-
assert_eq!(s.grades(), vec!
|
83
|
-
assert_eq!(s.grade(3),
|
84
|
-
|
85
|
-
assert_eq!(s.grade(7),
|
86
|
-
some_strings(&["Logan"]));
|
80
|
+
assert_eq!(s.grades(), vec![3, 7]);
|
81
|
+
assert_eq!(s.grade(3), some_strings(&["Chelsea"]));
|
82
|
+
assert_eq!(s.grade(7), some_strings(&["Logan"]));
|
87
83
|
}
|
@@ -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
|
|
@@ -31,9 +31,10 @@ The Hamming distance between these two DNA strands is 7.
|
|
31
31
|
|
32
32
|
# Implementation notes
|
33
33
|
|
34
|
-
The Hamming distance is only defined for sequences of equal length
|
35
|
-
|
36
|
-
of
|
34
|
+
The Hamming distance is only defined for sequences of equal length, so
|
35
|
+
an attempt to calculate it between sequences of different lengths should
|
36
|
+
not work. The general handling of this situation (e.g., raising an
|
37
|
+
exception vs returning a special value) may differ between languages.
|
37
38
|
|
38
39
|
## Rust Installation
|
39
40
|
|
@@ -48,11 +49,31 @@ Execute the tests with:
|
|
48
49
|
$ cargo test
|
49
50
|
```
|
50
51
|
|
51
|
-
All but the first test have been ignored.
|
52
|
-
pass,
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
All but the first test have been ignored. After you get the first test to
|
53
|
+
pass, open the tests source file wich is located in the `tests` directory
|
54
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
55
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
56
|
+
Continue, until you pass every test.
|
57
|
+
|
58
|
+
If you wish to run all tests without editing the tests source file, use:
|
59
|
+
|
60
|
+
```bash
|
61
|
+
$ cargo test -- --ignored
|
62
|
+
```
|
63
|
+
|
64
|
+
To run a specific test, for example `some_test`, you can use:
|
65
|
+
|
66
|
+
```bash
|
67
|
+
$ cargo test some_test
|
68
|
+
```
|
69
|
+
|
70
|
+
If the specfic test is ignored use:
|
71
|
+
|
72
|
+
```bash
|
73
|
+
$ cargo test some_test -- --ignored
|
74
|
+
```
|
75
|
+
|
76
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
56
77
|
|
57
78
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
58
79
|
haven't already, it will help you with organizing your files.
|
@@ -66,6 +87,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
66
87
|
[help-page]: http://exercism.io/languages/rust
|
67
88
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
68
89
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
90
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
69
91
|
|
70
92
|
## Source
|
71
93
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/// Return the Hamming distance between the strings,
|
2
2
|
/// or None if the lengths are mismatched.
|
3
3
|
pub fn hamming_distance(s1: &str, s2: &str) -> Option<usize> {
|
4
|
-
unimplemented!("What is the Hamming Distance between {:?} and {:?}",
|
5
|
-
s1, s2);
|
4
|
+
unimplemented!("What is the Hamming Distance between {:?} and {:?}", s1, s2);
|
6
5
|
}
|
@@ -27,11 +27,31 @@ Execute the tests with:
|
|
27
27
|
$ cargo test
|
28
28
|
```
|
29
29
|
|
30
|
-
All but the first test have been ignored.
|
31
|
-
pass,
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
All but the first test have been ignored. After you get the first test to
|
31
|
+
pass, open the tests source file wich is located in the `tests` directory
|
32
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
33
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
34
|
+
Continue, until you pass every test.
|
35
|
+
|
36
|
+
If you wish to run all tests without editing the tests source file, use:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
$ cargo test -- --ignored
|
40
|
+
```
|
41
|
+
|
42
|
+
To run a specific test, for example `some_test`, you can use:
|
43
|
+
|
44
|
+
```bash
|
45
|
+
$ cargo test some_test
|
46
|
+
```
|
47
|
+
|
48
|
+
If the specfic test is ignored use:
|
49
|
+
|
50
|
+
```bash
|
51
|
+
$ cargo test some_test -- --ignored
|
52
|
+
```
|
53
|
+
|
54
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
35
55
|
|
36
56
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
37
57
|
haven't already, it will help you with organizing your files.
|
@@ -45,6 +65,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
45
65
|
[help-page]: http://exercism.io/languages/rust
|
46
66
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
47
67
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
68
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
48
69
|
|
49
70
|
## Source
|
50
71
|
|
@@ -20,11 +20,31 @@ Execute the tests with:
|
|
20
20
|
$ cargo test
|
21
21
|
```
|
22
22
|
|
23
|
-
All but the first test have been ignored.
|
24
|
-
pass,
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
All but the first test have been ignored. After you get the first test to
|
24
|
+
pass, open the tests source file wich is located in the `tests` directory
|
25
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
26
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
27
|
+
Continue, until you pass every test.
|
28
|
+
|
29
|
+
If you wish to run all tests without editing the tests source file, use:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ cargo test -- --ignored
|
33
|
+
```
|
34
|
+
|
35
|
+
To run a specific test, for example `some_test`, you can use:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
$ cargo test some_test
|
39
|
+
```
|
40
|
+
|
41
|
+
If the specfic test is ignored use:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
$ cargo test some_test -- --ignored
|
45
|
+
```
|
46
|
+
|
47
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
28
48
|
|
29
49
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
30
50
|
haven't already, it will help you with organizing your files.
|
@@ -38,6 +58,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
38
58
|
[help-page]: http://exercism.io/languages/rust
|
39
59
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
40
60
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
61
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
41
62
|
|
42
63
|
## Source
|
43
64
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -53,11 +53,31 @@ Execute the tests with:
|
|
53
53
|
$ cargo test
|
54
54
|
```
|
55
55
|
|
56
|
-
All but the first test have been ignored.
|
57
|
-
pass,
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
All but the first test have been ignored. After you get the first test to
|
57
|
+
pass, open the tests source file wich is located in the `tests` directory
|
58
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
59
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
60
|
+
Continue, until you pass every test.
|
61
|
+
|
62
|
+
If you wish to run all tests without editing the tests source file, use:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
$ cargo test -- --ignored
|
66
|
+
```
|
67
|
+
|
68
|
+
To run a specific test, for example `some_test`, you can use:
|
69
|
+
|
70
|
+
```bash
|
71
|
+
$ cargo test some_test
|
72
|
+
```
|
73
|
+
|
74
|
+
If the specfic test is ignored use:
|
75
|
+
|
76
|
+
```bash
|
77
|
+
$ cargo test some_test -- --ignored
|
78
|
+
```
|
79
|
+
|
80
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
61
81
|
|
62
82
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
63
83
|
haven't already, it will help you with organizing your files.
|
@@ -71,6 +91,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
71
91
|
[help-page]: http://exercism.io/languages/rust
|
72
92
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
73
93
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
94
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
74
95
|
|
75
96
|
## Source
|
76
97
|
|