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
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# Twofer
|
2
2
|
|
3
3
|
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
4
4
|
|
@@ -11,6 +11,7 @@ When X is a name or "you".
|
|
11
11
|
If the given name is "Alice", the result should be "One for Alice, one for me."
|
12
12
|
If no name is given, the result should be "One for you, one for me."
|
13
13
|
|
14
|
+
|
14
15
|
## Rust Installation
|
15
16
|
|
16
17
|
Refer to the [exercism help page][help-page] for Rust installation and learning
|
@@ -24,11 +25,31 @@ Execute the tests with:
|
|
24
25
|
$ cargo test
|
25
26
|
```
|
26
27
|
|
27
|
-
All but the first test have been ignored.
|
28
|
-
pass,
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
All but the first test have been ignored. After you get the first test to
|
29
|
+
pass, open the tests source file wich is located in the `tests` directory
|
30
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
31
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
32
|
+
Continue, until you pass every test.
|
33
|
+
|
34
|
+
If you wish to run all tests without editing the tests source file, use:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
$ cargo test -- --ignored
|
38
|
+
```
|
39
|
+
|
40
|
+
To run a specific test, for example `some_test`, you can use:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
$ cargo test some_test
|
44
|
+
```
|
45
|
+
|
46
|
+
If the specfic test is ignored use:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
$ cargo test some_test -- --ignored
|
50
|
+
```
|
51
|
+
|
52
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
32
53
|
|
33
54
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
34
55
|
haven't already, it will help you with organizing your files.
|
@@ -42,6 +63,11 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
42
63
|
[help-page]: http://exercism.io/languages/rust
|
43
64
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
44
65
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
66
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
67
|
+
|
68
|
+
## Source
|
69
|
+
|
70
|
+
[https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
|
45
71
|
|
46
72
|
## Submitting Incomplete Solutions
|
47
|
-
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
73
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -1,3 +1,3 @@
|
|
1
|
-
pub fn twofer(name: &str)-> String {
|
1
|
+
pub fn twofer(name: &str) -> String {
|
2
2
|
unimplemented!("One for {}, one for me.", name);
|
3
|
-
}
|
3
|
+
}
|
@@ -8,7 +8,7 @@ fn empty_string() {
|
|
8
8
|
|
9
9
|
#[test]
|
10
10
|
#[ignore]
|
11
|
-
fn alice() {
|
11
|
+
fn alice() {
|
12
12
|
assert_eq!(twofer("Alice"), "One for Alice, one for me.");
|
13
13
|
}
|
14
14
|
|
@@ -16,4 +16,4 @@ fn alice() {
|
|
16
16
|
#[ignore]
|
17
17
|
fn bob() {
|
18
18
|
assert_eq!(twofer("Bob"), "One for Bob, one for me.");
|
19
|
-
}
|
19
|
+
}
|
@@ -44,11 +44,31 @@ Execute the tests with:
|
|
44
44
|
$ cargo test
|
45
45
|
```
|
46
46
|
|
47
|
-
All but the first test have been ignored.
|
48
|
-
pass,
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
All but the first test have been ignored. After you get the first test to
|
48
|
+
pass, open the tests source file wich is located in the `tests` directory
|
49
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
50
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
51
|
+
Continue, until you pass every test.
|
52
|
+
|
53
|
+
If you wish to run all tests without editing the tests source file, use:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
$ cargo test -- --ignored
|
57
|
+
```
|
58
|
+
|
59
|
+
To run a specific test, for example `some_test`, you can use:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
$ cargo test some_test
|
63
|
+
```
|
64
|
+
|
65
|
+
If the specfic test is ignored use:
|
66
|
+
|
67
|
+
```bash
|
68
|
+
$ cargo test some_test -- --ignored
|
69
|
+
```
|
70
|
+
|
71
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
52
72
|
|
53
73
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
54
74
|
haven't already, it will help you with organizing your files.
|
@@ -62,6 +82,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
62
82
|
[help-page]: http://exercism.io/languages/rust
|
63
83
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
64
84
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
85
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
65
86
|
|
66
87
|
## Source
|
67
88
|
|
@@ -26,57 +26,80 @@ fn to_triple_byte() {
|
|
26
26
|
#[test]
|
27
27
|
#[ignore]
|
28
28
|
fn to_quadruple_byte() {
|
29
|
-
assert_eq!(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
assert_eq!(
|
34
|
-
|
29
|
+
assert_eq!(
|
30
|
+
&[0x81, 0x80, 0x80, 0x00],
|
31
|
+
vlq::to_bytes(&[0x20_0000]).as_slice()
|
32
|
+
);
|
33
|
+
assert_eq!(
|
34
|
+
&[0xc0, 0x80, 0x80, 0x00],
|
35
|
+
vlq::to_bytes(&[0x0800_0000]).as_slice()
|
36
|
+
);
|
37
|
+
assert_eq!(
|
38
|
+
&[0xff, 0xff, 0xff, 0x7f],
|
39
|
+
vlq::to_bytes(&[0x0fff_ffff]).as_slice()
|
40
|
+
);
|
35
41
|
}
|
36
42
|
|
37
43
|
#[test]
|
38
44
|
#[ignore]
|
39
45
|
fn to_quintuple_byte() {
|
40
|
-
assert_eq!(
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
assert_eq!(
|
45
|
-
|
46
|
+
assert_eq!(
|
47
|
+
&[0x81, 0x80, 0x80, 0x80, 0x00],
|
48
|
+
vlq::to_bytes(&[0x1000_0000]).as_slice()
|
49
|
+
);
|
50
|
+
assert_eq!(
|
51
|
+
&[0x8f, 0xf8, 0x80, 0x80, 0x00],
|
52
|
+
vlq::to_bytes(&[0xff00_0000]).as_slice()
|
53
|
+
);
|
54
|
+
assert_eq!(
|
55
|
+
&[0x8f, 0xff, 0xff, 0xff, 0x7f],
|
56
|
+
vlq::to_bytes(&[0xffff_ffff]).as_slice()
|
57
|
+
);
|
46
58
|
}
|
47
59
|
|
48
60
|
#[test]
|
49
61
|
#[ignore]
|
50
62
|
fn from_bytes() {
|
51
63
|
assert_eq!(Ok(vec![0x7f]), vlq::from_bytes(&[0x7f]));
|
52
|
-
assert_eq!(Ok(vec![0x2000]),
|
53
|
-
|
54
|
-
assert_eq!(
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
assert_eq!(
|
59
|
-
|
64
|
+
assert_eq!(Ok(vec![0x2000]), vlq::from_bytes(&[0xc0, 0x00]));
|
65
|
+
assert_eq!(Ok(vec![0x1f_ffff]), vlq::from_bytes(&[0xff, 0xff, 0x7f]));
|
66
|
+
assert_eq!(
|
67
|
+
Ok(vec![0x20_0000]),
|
68
|
+
vlq::from_bytes(&[0x81, 0x80, 0x80, 0x00])
|
69
|
+
);
|
70
|
+
assert_eq!(
|
71
|
+
Ok(vec![0xffff_ffff]),
|
72
|
+
vlq::from_bytes(&[0x8f, 0xff, 0xff, 0xff, 0x7f])
|
73
|
+
);
|
60
74
|
}
|
61
75
|
|
62
|
-
|
63
76
|
#[test]
|
64
77
|
#[ignore]
|
65
78
|
fn to_bytes_multiple_values() {
|
66
79
|
assert_eq!(&[0x40, 0x7f], vlq::to_bytes(&[0x40, 0x7f]).as_slice());
|
67
|
-
assert_eq!(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
80
|
+
assert_eq!(
|
81
|
+
&[0x81, 0x80, 0x00, 0xc8, 0xe8, 0x56],
|
82
|
+
vlq::to_bytes(&[0x4000, 0x12_3456]).as_slice()
|
83
|
+
);
|
84
|
+
assert_eq!(
|
85
|
+
&[
|
86
|
+
0xc0, 0x00, 0xc8, 0xe8, 0x56, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0x7f, 0x81, 0x80,
|
87
|
+
0x00,
|
88
|
+
],
|
89
|
+
vlq::to_bytes(&[0x2000, 0x12_3456, 0x0fff_ffff, 0x00, 0x3fff, 0x4000]).as_slice()
|
90
|
+
);
|
72
91
|
}
|
73
92
|
|
74
93
|
#[test]
|
75
94
|
#[ignore]
|
76
95
|
fn from_bytes_multiple_values() {
|
77
|
-
assert_eq!(
|
78
|
-
|
79
|
-
|
96
|
+
assert_eq!(
|
97
|
+
Ok(vec![0x2000, 0x12_3456, 0x0fff_ffff, 0x00, 0x3fff, 0x4000]),
|
98
|
+
vlq::from_bytes(&[
|
99
|
+
0xc0, 0x00, 0xc8, 0xe8, 0x56, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0x7f, 0x81, 0x80,
|
100
|
+
0x00,
|
101
|
+
])
|
102
|
+
);
|
80
103
|
}
|
81
104
|
|
82
105
|
#[test]
|
@@ -94,13 +117,18 @@ fn zero_incomplete_byte_sequence() {
|
|
94
117
|
#[test]
|
95
118
|
#[ignore]
|
96
119
|
fn overflow_u32() {
|
97
|
-
assert_eq!(
|
120
|
+
assert_eq!(
|
121
|
+
Err(vlq::Error::Overflow),
|
122
|
+
vlq::from_bytes(&[0xff, 0xff, 0xff, 0xff, 0x7f])
|
123
|
+
);
|
98
124
|
}
|
99
125
|
|
100
126
|
#[test]
|
101
127
|
#[ignore]
|
102
128
|
fn chained_execution_is_identity() {
|
103
129
|
let test = &[0xf2, 0xf6, 0x96, 0x9c, 0x3b, 0x39, 0x2e, 0x30, 0xb3, 0x24];
|
104
|
-
assert_eq!(
|
105
|
-
|
130
|
+
assert_eq!(
|
131
|
+
Ok(Vec::from(&test[..])),
|
132
|
+
vlq::from_bytes(&vlq::to_bytes(test))
|
133
|
+
);
|
106
134
|
}
|
@@ -24,11 +24,31 @@ Execute the tests with:
|
|
24
24
|
$ cargo test
|
25
25
|
```
|
26
26
|
|
27
|
-
All but the first test have been ignored.
|
28
|
-
pass,
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
All but the first test have been ignored. After you get the first test to
|
28
|
+
pass, open the tests source file wich is located in the `tests` directory
|
29
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
30
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
31
|
+
Continue, until you pass every test.
|
32
|
+
|
33
|
+
If you wish to run all tests without editing the tests source file, use:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
$ cargo test -- --ignored
|
37
|
+
```
|
38
|
+
|
39
|
+
To run a specific test, for example `some_test`, you can use:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
$ cargo test some_test
|
43
|
+
```
|
44
|
+
|
45
|
+
If the specfic test is ignored use:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ cargo test some_test -- --ignored
|
49
|
+
```
|
50
|
+
|
51
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
32
52
|
|
33
53
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
34
54
|
haven't already, it will help you with organizing your files.
|
@@ -42,6 +62,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
42
62
|
[help-page]: http://exercism.io/languages/rust
|
43
63
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
44
64
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
65
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
45
66
|
|
46
67
|
## Source
|
47
68
|
|
@@ -12,7 +12,7 @@ fn check_word_count(s: &str, pairs: &[(&str, u32)]) {
|
|
12
12
|
assert_eq!((k, m.remove(&k.to_string()).unwrap_or(0)), (k, v));
|
13
13
|
}
|
14
14
|
// may fail with a message that clearly shows all extra pairs in the map
|
15
|
-
assert_eq!(m.iter().collect::<Vec<(&String
|
15
|
+
assert_eq!(m.iter().collect::<Vec<(&String, &u32)>>(), vec![]);
|
16
16
|
}
|
17
17
|
|
18
18
|
#[test]
|
@@ -23,11 +23,7 @@ fn test_count_one_word() {
|
|
23
23
|
#[test]
|
24
24
|
#[ignore]
|
25
25
|
fn test_count_one_of_each() {
|
26
|
-
check_word_count(
|
27
|
-
"one of each",
|
28
|
-
&[("one", 1),
|
29
|
-
("of", 1),
|
30
|
-
("each", 1)]);
|
26
|
+
check_word_count("one of each", &[("one", 1), ("of", 1), ("each", 1)]);
|
31
27
|
}
|
32
28
|
|
33
29
|
#[test]
|
@@ -35,11 +31,8 @@ fn test_count_one_of_each() {
|
|
35
31
|
fn test_count_multiple_occurrences() {
|
36
32
|
check_word_count(
|
37
33
|
"one fish two fish red fish blue fish",
|
38
|
-
&[("one", 1),
|
39
|
-
|
40
|
-
("two", 1),
|
41
|
-
("red", 1),
|
42
|
-
("blue", 1)]);
|
34
|
+
&[("one", 1), ("fish", 4), ("two", 1), ("red", 1), ("blue", 1)],
|
35
|
+
);
|
43
36
|
}
|
44
37
|
|
45
38
|
#[test]
|
@@ -47,11 +40,14 @@ fn test_count_multiple_occurrences() {
|
|
47
40
|
fn test_ignore_punctuation() {
|
48
41
|
check_word_count(
|
49
42
|
"car : carpet as java : javascript!!&@$%^&",
|
50
|
-
&[
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
&[
|
44
|
+
("car", 1),
|
45
|
+
("carpet", 1),
|
46
|
+
("as", 1),
|
47
|
+
("java", 1),
|
48
|
+
("javascript", 1),
|
49
|
+
],
|
50
|
+
);
|
55
51
|
}
|
56
52
|
|
57
53
|
#[test]
|
@@ -59,16 +55,12 @@ fn test_ignore_punctuation() {
|
|
59
55
|
fn test_include_numbers() {
|
60
56
|
check_word_count(
|
61
57
|
"testing, 1, 2 testing",
|
62
|
-
&[("testing", 2),
|
63
|
-
|
64
|
-
("2", 1)]);
|
58
|
+
&[("testing", 2), ("1", 1), ("2", 1)],
|
59
|
+
);
|
65
60
|
}
|
66
61
|
|
67
62
|
#[test]
|
68
63
|
#[ignore]
|
69
64
|
fn test_normalize_case() {
|
70
|
-
check_word_count(
|
71
|
-
"go Go GO Stop stop",
|
72
|
-
&[("go", 3),
|
73
|
-
("stop", 2)]);
|
65
|
+
check_word_count("go Go GO Stop stop", &[("go", 3), ("stop", 2)]);
|
74
66
|
}
|
@@ -64,11 +64,31 @@ Execute the tests with:
|
|
64
64
|
$ cargo test
|
65
65
|
```
|
66
66
|
|
67
|
-
All but the first test have been ignored.
|
68
|
-
pass,
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
All but the first test have been ignored. After you get the first test to
|
68
|
+
pass, open the tests source file wich is located in the `tests` directory
|
69
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
70
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
71
|
+
Continue, until you pass every test.
|
72
|
+
|
73
|
+
If you wish to run all tests without editing the tests source file, use:
|
74
|
+
|
75
|
+
```bash
|
76
|
+
$ cargo test -- --ignored
|
77
|
+
```
|
78
|
+
|
79
|
+
To run a specific test, for example `some_test`, you can use:
|
80
|
+
|
81
|
+
```bash
|
82
|
+
$ cargo test some_test
|
83
|
+
```
|
84
|
+
|
85
|
+
If the specfic test is ignored use:
|
86
|
+
|
87
|
+
```bash
|
88
|
+
$ cargo test some_test -- --ignored
|
89
|
+
```
|
90
|
+
|
91
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
72
92
|
|
73
93
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
74
94
|
haven't already, it will help you with organizing your files.
|
@@ -82,6 +102,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
82
102
|
[help-page]: http://exercism.io/languages/rust
|
83
103
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
84
104
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
105
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
85
106
|
|
86
107
|
## Source
|
87
108
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.1.
|
4
|
+
version: 2.2.1.172
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -13152,6 +13152,7 @@ files:
|
|
13152
13152
|
- tracks/rust/_test/ensure-stubs-compile.sh
|
13153
13153
|
- tracks/rust/_test/verify-exercise-difficulties.sh
|
13154
13154
|
- tracks/rust/bin/fetch-configlet
|
13155
|
+
- tracks/rust/bin/format_exercises
|
13155
13156
|
- tracks/rust/bin/init_exercise.py
|
13156
13157
|
- tracks/rust/bin/test-exercise
|
13157
13158
|
- tracks/rust/config.json
|