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
@@ -80,11 +80,31 @@ Execute the tests with:
|
|
80
80
|
$ cargo test
|
81
81
|
```
|
82
82
|
|
83
|
-
All but the first test have been ignored.
|
84
|
-
pass,
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
All but the first test have been ignored. After you get the first test to
|
84
|
+
pass, open the tests source file wich is located in the `tests` directory
|
85
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
86
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
87
|
+
Continue, until you pass every test.
|
88
|
+
|
89
|
+
If you wish to run all tests without editing the tests source file, use:
|
90
|
+
|
91
|
+
```bash
|
92
|
+
$ cargo test -- --ignored
|
93
|
+
```
|
94
|
+
|
95
|
+
To run a specific test, for example `some_test`, you can use:
|
96
|
+
|
97
|
+
```bash
|
98
|
+
$ cargo test some_test
|
99
|
+
```
|
100
|
+
|
101
|
+
If the specfic test is ignored use:
|
102
|
+
|
103
|
+
```bash
|
104
|
+
$ cargo test some_test -- --ignored
|
105
|
+
```
|
106
|
+
|
107
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
88
108
|
|
89
109
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
90
110
|
haven't already, it will help you with organizing your files.
|
@@ -98,6 +118,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
98
118
|
[help-page]: http://exercism.io/languages/rust
|
99
119
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
100
120
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
121
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
101
122
|
|
102
123
|
## Source
|
103
124
|
|
@@ -15,10 +15,7 @@ use book_store::*;
|
|
15
15
|
///
|
16
16
|
/// Expected input format: ('basket', 'targetgrouping')
|
17
17
|
fn process_total_case(input: (Vec<usize>, Vec<Vec<usize>>), expected: usize) {
|
18
|
-
assert_eq!(
|
19
|
-
lowest_price(&input.0),
|
20
|
-
expected
|
21
|
-
)
|
18
|
+
assert_eq!(lowest_price(&input.0), expected)
|
22
19
|
}
|
23
20
|
|
24
21
|
// Return the total basket price after applying the best discount.
|
@@ -26,14 +23,12 @@ fn process_total_case(input: (Vec<usize>, Vec<Vec<usize>>), expected: usize) {
|
|
26
23
|
// a single series. There is no discount advantage for having more than
|
27
24
|
// one copy of any single book in a grouping.
|
28
25
|
|
29
|
-
|
30
26
|
#[test]
|
31
27
|
/// Only a single book
|
32
28
|
fn test_only_a_single_book() {
|
33
29
|
process_total_case((vec![1], vec![vec![1]]), 800);
|
34
30
|
}
|
35
31
|
|
36
|
-
|
37
32
|
#[test]
|
38
33
|
#[ignore]
|
39
34
|
/// Two of the same book
|
@@ -41,7 +36,6 @@ fn test_two_of_the_same_book() {
|
|
41
36
|
process_total_case((vec![2, 2], vec![vec![2], vec![2]]), 1_600);
|
42
37
|
}
|
43
38
|
|
44
|
-
|
45
39
|
#[test]
|
46
40
|
#[ignore]
|
47
41
|
/// Empty basket
|
@@ -49,7 +43,6 @@ fn test_empty_basket() {
|
|
49
43
|
process_total_case((vec![], vec![]), 0);
|
50
44
|
}
|
51
45
|
|
52
|
-
|
53
46
|
#[test]
|
54
47
|
#[ignore]
|
55
48
|
/// Two different books
|
@@ -57,7 +50,6 @@ fn test_two_different_books() {
|
|
57
50
|
process_total_case((vec![1, 2], vec![vec![1, 2]]), 1_520);
|
58
51
|
}
|
59
52
|
|
60
|
-
|
61
53
|
#[test]
|
62
54
|
#[ignore]
|
63
55
|
/// Three different books
|
@@ -65,7 +57,6 @@ fn test_three_different_books() {
|
|
65
57
|
process_total_case((vec![1, 2, 3], vec![vec![1, 2, 3]]), 2_160);
|
66
58
|
}
|
67
59
|
|
68
|
-
|
69
60
|
#[test]
|
70
61
|
#[ignore]
|
71
62
|
/// Four different books
|
@@ -73,7 +64,6 @@ fn test_four_different_books() {
|
|
73
64
|
process_total_case((vec![1, 2, 3, 4], vec![vec![1, 2, 3, 4]]), 2_560);
|
74
65
|
}
|
75
66
|
|
76
|
-
|
77
67
|
#[test]
|
78
68
|
#[ignore]
|
79
69
|
/// Five different books
|
@@ -81,57 +71,95 @@ fn test_five_different_books() {
|
|
81
71
|
process_total_case((vec![1, 2, 3, 4, 5], vec![vec![1, 2, 3, 4, 5]]), 3_000);
|
82
72
|
}
|
83
73
|
|
84
|
-
|
85
74
|
#[test]
|
86
75
|
#[ignore]
|
87
76
|
/// Two groups of four is cheaper than group of five plus group of three
|
88
77
|
fn test_two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three() {
|
89
|
-
process_total_case(
|
78
|
+
process_total_case(
|
79
|
+
(
|
80
|
+
vec![1, 1, 2, 2, 3, 3, 4, 5],
|
81
|
+
vec![vec![1, 2, 3, 4], vec![1, 2, 3, 5]],
|
82
|
+
),
|
83
|
+
5_120,
|
84
|
+
);
|
90
85
|
}
|
91
86
|
|
92
|
-
|
93
87
|
#[test]
|
94
88
|
#[ignore]
|
95
89
|
/// Group of four plus group of two is cheaper than two groups of three
|
96
90
|
fn test_group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three() {
|
97
|
-
process_total_case(
|
91
|
+
process_total_case(
|
92
|
+
(vec![1, 1, 2, 2, 3, 4], vec![vec![1, 2, 3, 4], vec![1, 2]]),
|
93
|
+
4_080,
|
94
|
+
);
|
98
95
|
}
|
99
96
|
|
100
|
-
|
101
97
|
#[test]
|
102
98
|
#[ignore]
|
103
99
|
/// Two each of first 4 books and 1 copy each of rest
|
104
100
|
fn test_two_each_of_first_4_books_and_1_copy_each_of_rest() {
|
105
|
-
process_total_case(
|
101
|
+
process_total_case(
|
102
|
+
(
|
103
|
+
vec![1, 1, 2, 2, 3, 3, 4, 4, 5],
|
104
|
+
vec![vec![1, 2, 3, 4, 5], vec![1, 2, 3, 4]],
|
105
|
+
),
|
106
|
+
5_560,
|
107
|
+
);
|
106
108
|
}
|
107
109
|
|
108
|
-
|
109
110
|
#[test]
|
110
111
|
#[ignore]
|
111
112
|
/// Two copies of each book
|
112
113
|
fn test_two_copies_of_each_book() {
|
113
|
-
process_total_case(
|
114
|
+
process_total_case(
|
115
|
+
(
|
116
|
+
vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
|
117
|
+
vec![vec![1, 2, 3, 4, 5], vec![1, 2, 3, 4, 5]],
|
118
|
+
),
|
119
|
+
6_000,
|
120
|
+
);
|
114
121
|
}
|
115
122
|
|
116
|
-
|
117
123
|
#[test]
|
118
124
|
#[ignore]
|
119
125
|
/// Three copies of first book and 2 each of remaining
|
120
126
|
fn test_three_copies_of_first_book_and_2_each_of_remaining() {
|
121
|
-
process_total_case(
|
127
|
+
process_total_case(
|
128
|
+
(
|
129
|
+
vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1],
|
130
|
+
vec![vec![1, 2, 3, 4, 5], vec![1, 2, 3, 4, 5], vec![1]],
|
131
|
+
),
|
132
|
+
6_800,
|
133
|
+
);
|
122
134
|
}
|
123
135
|
|
124
|
-
|
125
136
|
#[test]
|
126
137
|
#[ignore]
|
127
138
|
/// Three each of first 2 books and 2 each of remaining books
|
128
139
|
fn test_three_each_of_first_2_books_and_2_each_of_remaining_books() {
|
129
|
-
process_total_case(
|
140
|
+
process_total_case(
|
141
|
+
(
|
142
|
+
vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2],
|
143
|
+
vec![vec![1, 2, 3, 4, 5], vec![1, 2, 3, 4, 5], vec![1, 2]],
|
144
|
+
),
|
145
|
+
7_520,
|
146
|
+
);
|
130
147
|
}
|
131
148
|
|
132
149
|
#[test]
|
133
150
|
#[ignore]
|
134
151
|
/// Four groups of four are cheaper than two groups each of five and three
|
135
152
|
fn test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three() {
|
136
|
-
process_total_case(
|
153
|
+
process_total_case(
|
154
|
+
(
|
155
|
+
vec![1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5],
|
156
|
+
vec![
|
157
|
+
vec![1, 2, 3, 4],
|
158
|
+
vec![1, 2, 3, 5],
|
159
|
+
vec![1, 2, 3, 4],
|
160
|
+
vec![1, 2, 3, 5],
|
161
|
+
],
|
162
|
+
),
|
163
|
+
10_240,
|
164
|
+
);
|
137
165
|
}
|
@@ -73,11 +73,31 @@ Execute the tests with:
|
|
73
73
|
$ cargo test
|
74
74
|
```
|
75
75
|
|
76
|
-
All but the first test have been ignored.
|
77
|
-
pass,
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
All but the first test have been ignored. After you get the first test to
|
77
|
+
pass, open the tests source file wich is located in the `tests` directory
|
78
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
79
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
80
|
+
Continue, until you pass every test.
|
81
|
+
|
82
|
+
If you wish to run all tests without editing the tests source file, use:
|
83
|
+
|
84
|
+
```bash
|
85
|
+
$ cargo test -- --ignored
|
86
|
+
```
|
87
|
+
|
88
|
+
To run a specific test, for example `some_test`, you can use:
|
89
|
+
|
90
|
+
```bash
|
91
|
+
$ cargo test some_test
|
92
|
+
```
|
93
|
+
|
94
|
+
If the specfic test is ignored use:
|
95
|
+
|
96
|
+
```bash
|
97
|
+
$ cargo test some_test -- --ignored
|
98
|
+
```
|
99
|
+
|
100
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
81
101
|
|
82
102
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
83
103
|
haven't already, it will help you with organizing your files.
|
@@ -91,6 +111,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
91
111
|
[help-page]: http://exercism.io/languages/rust
|
92
112
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
93
113
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
114
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
94
115
|
|
95
116
|
## Source
|
96
117
|
|
@@ -347,7 +347,8 @@ fn the_two_balls_after_a_final_strike_can_not_be_a_non_strike_followed_by_a_stri
|
|
347
347
|
|
348
348
|
#[test]
|
349
349
|
#[ignore]
|
350
|
-
fn second_bonus_ball_after_a_final_strike_can_not_score_an_invalid_number_of_pins_even_if_first_is_strike(
|
350
|
+
fn second_bonus_ball_after_a_final_strike_can_not_score_an_invalid_number_of_pins_even_if_first_is_strike(
|
351
|
+
) {
|
351
352
|
let mut game = BowlingGame::new();
|
352
353
|
|
353
354
|
for _ in 0..18 {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# Bracket Push
|
2
2
|
|
3
|
-
Given a string containing brackets `[]`, braces `{}
|
4
|
-
verify that all
|
3
|
+
Given a string containing brackets `[]`, braces `{}`, parentheses `()`,
|
4
|
+
or any combination thereof, verify that any and all pairs are matched
|
5
|
+
and nested correctly.
|
5
6
|
|
6
7
|
# Bracket Push in Rust
|
7
8
|
|
@@ -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,7 @@ 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
|
45
67
|
|
46
68
|
## Source
|
47
69
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -63,11 +63,31 @@ Execute the tests with:
|
|
63
63
|
$ cargo test
|
64
64
|
```
|
65
65
|
|
66
|
-
All but the first test have been ignored.
|
67
|
-
pass,
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
All but the first test have been ignored. After you get the first test to
|
67
|
+
pass, open the tests source file wich is located in the `tests` directory
|
68
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
69
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
70
|
+
Continue, until you pass every test.
|
71
|
+
|
72
|
+
If you wish to run all tests without editing the tests source file, use:
|
73
|
+
|
74
|
+
```bash
|
75
|
+
$ cargo test -- --ignored
|
76
|
+
```
|
77
|
+
|
78
|
+
To run a specific test, for example `some_test`, you can use:
|
79
|
+
|
80
|
+
```bash
|
81
|
+
$ cargo test some_test
|
82
|
+
```
|
83
|
+
|
84
|
+
If the specfic test is ignored use:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
$ cargo test some_test -- --ignored
|
88
|
+
```
|
89
|
+
|
90
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
71
91
|
|
72
92
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
73
93
|
haven't already, it will help you with organizing your files.
|
@@ -81,6 +101,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
81
101
|
[help-page]: http://exercism.io/languages/rust
|
82
102
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
83
103
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
104
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
84
105
|
|
85
106
|
## Source
|
86
107
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -31,11 +31,31 @@ Execute the tests with:
|
|
31
31
|
$ cargo test
|
32
32
|
```
|
33
33
|
|
34
|
-
All but the first test have been ignored.
|
35
|
-
pass,
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
All but the first test have been ignored. After you get the first test to
|
35
|
+
pass, open the tests source file wich is located in the `tests` directory
|
36
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
37
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
38
|
+
Continue, until you pass every test.
|
39
|
+
|
40
|
+
If you wish to run all tests without editing the tests source file, use:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
$ cargo test -- --ignored
|
44
|
+
```
|
45
|
+
|
46
|
+
To run a specific test, for example `some_test`, you can use:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
$ cargo test some_test
|
50
|
+
```
|
51
|
+
|
52
|
+
If the specfic test is ignored use:
|
53
|
+
|
54
|
+
```bash
|
55
|
+
$ cargo test some_test -- --ignored
|
56
|
+
```
|
57
|
+
|
58
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
39
59
|
|
40
60
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
41
61
|
haven't already, it will help you with organizing your files.
|
@@ -49,6 +69,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
49
69
|
[help-page]: http://exercism.io/languages/rust
|
50
70
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
51
71
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
72
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
52
73
|
|
53
74
|
## Source
|
54
75
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|