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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e0c296a35d14811283022f1b7c0d4632d192794
|
4
|
+
data.tar.gz: 824e6e6fc0a08cb04754baca3e36435af840c13c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3aab4d9b282d0b7d8609ed74298f52da02b974eedfea2e32d8cdfc95453a8b31203dc97e278bbf484e4060dff128a0b23264bad371412aaa43bd41c0178deba
|
7
|
+
data.tar.gz: 58170622fc1a49bf03c7dc3944f7b353bc5846c000ac94e6959405dfb6a9722e0142841e8f3d4548a677f967658a271bcbaa08e6f097efa17990fb566cc8f98a
|
data/lib/trackler/version.rb
CHANGED
@@ -16,27 +16,27 @@ var testCases = []struct {
|
|
16
16
|
},
|
17
17
|
{
|
18
18
|
"singleton input = singleton output",
|
19
|
-
[]Domino{
|
19
|
+
[]Domino{{1, 1}},
|
20
20
|
true,
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"singleton that can't be chained",
|
24
|
-
[]Domino{
|
24
|
+
[]Domino{{1, 2}},
|
25
25
|
false,
|
26
26
|
},
|
27
27
|
{
|
28
28
|
"three elements",
|
29
|
-
[]Domino{
|
29
|
+
[]Domino{{1, 2}, {3, 1}, {2, 3}},
|
30
30
|
true,
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"can reverse dominoes",
|
34
|
-
[]Domino{
|
34
|
+
[]Domino{{1, 2}, {1, 3}, {2, 3}},
|
35
35
|
true,
|
36
36
|
},
|
37
37
|
{
|
38
38
|
"can't be chained",
|
39
|
-
[]Domino{
|
39
|
+
[]Domino{{1, 2}, {4, 1}, {2, 3}},
|
40
40
|
false,
|
41
41
|
},
|
42
42
|
{
|
@@ -46,17 +46,17 @@ var testCases = []struct {
|
|
46
46
|
//Nevertheless, there is no chain here, as there's no way to get from 1 to 2.
|
47
47
|
//This test (and the two following) prevent solutions from using the even-degree test as the sole criterion,
|
48
48
|
//as that is not a sufficient condition.
|
49
|
-
[]Domino{
|
49
|
+
[]Domino{{1, 1}, {2, 2}},
|
50
50
|
false,
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"disconnected - double loop",
|
54
|
-
[]Domino{
|
54
|
+
[]Domino{{1, 2}, {2, 1}, {3, 4}, {4, 3}},
|
55
55
|
false,
|
56
56
|
},
|
57
57
|
{
|
58
58
|
"disconnected - single isolated",
|
59
|
-
[]Domino{
|
59
|
+
[]Domino{{1, 2}, {2, 3}, {3, 1}, {4, 4}},
|
60
60
|
false,
|
61
61
|
},
|
62
62
|
{
|
@@ -66,17 +66,17 @@ var testCases = []struct {
|
|
66
66
|
//there is no chain possible.
|
67
67
|
//There is indeed a chain here, so this test checks for this line of reasoning.
|
68
68
|
//You need to place the (2, 4) after the (1, 2) rather than the (2, 3).
|
69
|
-
[]Domino{
|
69
|
+
[]Domino{{1, 2}, {2, 3}, {3, 1}, {2, 4}, {2, 4}},
|
70
70
|
true,
|
71
71
|
},
|
72
72
|
{
|
73
73
|
"separate loops",
|
74
|
-
[]Domino{
|
74
|
+
[]Domino{{1, 2}, {2, 3}, {3, 1}, {1, 1}, {2, 2}, {3, 3}},
|
75
75
|
true,
|
76
76
|
},
|
77
77
|
{
|
78
78
|
"nine elements",
|
79
|
-
[]Domino{
|
79
|
+
[]Domino{{1, 2}, {5, 3}, {3, 1}, {1, 2}, {2, 4}, {1, 6}, {2, 3}, {3, 4}, {5, 6}},
|
80
80
|
true,
|
81
81
|
},
|
82
82
|
}
|
data/tracks/ocaml/config.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"language": "OCaml",
|
3
3
|
"active": true,
|
4
|
-
"blurb": "",
|
4
|
+
"blurb": "OCaml is a functional and object-oriented language, used both in industry and as a teaching language to elegantly solve problems. The strong type system, with type inference, is useful for catching mistakes.",
|
5
5
|
"exercises": [
|
6
6
|
{
|
7
7
|
"slug": "hello-world",
|
data/tracks/ocaml/docs/ABOUT.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
[OCaml](https://ocaml.org/) is an industrial strength programming language supporting functional, imperative and object-oriented styles.
|
2
|
-
|
3
|
-
OCaml
|
4
|
-
[
|
1
|
+
[OCaml](https://ocaml.org/) is an industrial strength programming language supporting functional, imperative and object-oriented styles - but don't worry if you're not familiar with these, as it's used as a teaching language by a lot of institutions (including Cornell and Princeton).
|
2
|
+
|
3
|
+
One of the best features of OCaml is the rich and powerful [type system](https://en.wikipedia.org/wiki/Type_system) - this is useful to catch some mistakes early on saving developers a huge amount of frustration.
|
4
|
+
Also, [type inference](https://en.wikipedia.org/wiki/Type_inference) relieves developers from having to specify types in the code - the compiler will work these out for you!
|
5
|
+
|
6
|
+
It's used by Facebook (for static code analysis with [Infer](http://fbinfer.com/)) and Jane Street (for providing strong guarantees for their internal trading systems), and has influenced the [F# functional programming language](https://fsharp.org/) and [ReasonML](https://reasonml.github.io/).
|
@@ -1,13 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"language": "Windows PowerShell",
|
3
3
|
"active": false,
|
4
|
-
"blurb": "",
|
4
|
+
"blurb": "Task-based command-line shell and scripting language designed especially for system administration.",
|
5
5
|
"checklist_issue": 4,
|
6
6
|
"exercises": [
|
7
7
|
{
|
8
8
|
"slug": "hello-world",
|
9
9
|
"uuid": "83c215e6-4a4e-4302-8d68-47f367478d2c",
|
10
|
-
"core":
|
10
|
+
"core": true,
|
11
|
+
"auto_approve": true,
|
11
12
|
"unlocked_by": null,
|
12
13
|
"difficulty": 1,
|
13
14
|
"topics": [
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# Format existing exercises using rustfmt
|
3
|
+
|
4
|
+
RUST_TRACK_REPO_PATH=$(cd "$(dirname "$0")/.." && pwd)
|
5
|
+
|
6
|
+
EXERCISES_PATH="${RUST_TRACK_REPO_PATH}/exercises/"
|
7
|
+
|
8
|
+
# Some exercises use custom formatting for illustration purpose and should not be formatted.
|
9
|
+
IGNORED_EXERCISES=(
|
10
|
+
"diamond"
|
11
|
+
"minesweeper"
|
12
|
+
"rectangles"
|
13
|
+
)
|
14
|
+
|
15
|
+
# Iterate over every exercise directory and if it is not ignored - format it
|
16
|
+
for exercise_dir in ${EXERCISES_PATH}/*; do
|
17
|
+
exercise_name=${exercise_dir##*/}
|
18
|
+
|
19
|
+
if [[ " ${IGNORED_EXERCISES[*]} " == *"$exercise_name"* ]]; then
|
20
|
+
echo "$exercise_name - Ignored"
|
21
|
+
else
|
22
|
+
(
|
23
|
+
echo "$exercise_name - Formatting"
|
24
|
+
|
25
|
+
cd "$exercise_dir"
|
26
|
+
|
27
|
+
cargo fmt
|
28
|
+
)
|
29
|
+
fi
|
30
|
+
|
31
|
+
done
|
data/tracks/rust/config.json
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
"slug": "hello-world",
|
13
13
|
"uuid": "13ec1ebe-d71b-436f-ab12-25305e814171",
|
14
14
|
"core": false,
|
15
|
+
"auto_approve": true,
|
15
16
|
"unlocked_by": null,
|
16
17
|
"difficulty": 1,
|
17
18
|
"topics": [
|
@@ -81,7 +82,10 @@
|
|
81
82
|
"core": false,
|
82
83
|
"unlocked_by": null,
|
83
84
|
"difficulty": 1,
|
84
|
-
"topics":
|
85
|
+
"topics": [
|
86
|
+
"loops",
|
87
|
+
"primes"
|
88
|
+
]
|
85
89
|
},
|
86
90
|
{
|
87
91
|
"slug": "bob",
|
@@ -795,7 +799,11 @@
|
|
795
799
|
"core": false,
|
796
800
|
"unlocked_by": null,
|
797
801
|
"difficulty": 4,
|
798
|
-
"topics":
|
802
|
+
"topics": [
|
803
|
+
"ascii",
|
804
|
+
"regular_expressions",
|
805
|
+
"strings"
|
806
|
+
]
|
799
807
|
},
|
800
808
|
{
|
801
809
|
"slug": "diamond",
|
@@ -17,11 +17,31 @@ Execute the tests with:
|
|
17
17
|
$ cargo test
|
18
18
|
```
|
19
19
|
|
20
|
-
All but the first test have been ignored.
|
21
|
-
pass,
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
All but the first test have been ignored. After you get the first test to
|
21
|
+
pass, open the tests source file wich is located in the `tests` directory
|
22
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
23
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
24
|
+
Continue, until you pass every test.
|
25
|
+
|
26
|
+
If you wish to run all tests without editing the tests source file, use:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
$ cargo test -- --ignored
|
30
|
+
```
|
31
|
+
|
32
|
+
To run a specific test, for example `some_test`, you can use:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
$ cargo test some_test
|
36
|
+
```
|
37
|
+
|
38
|
+
If the specfic test is ignored use:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ cargo test some_test -- --ignored
|
42
|
+
```
|
43
|
+
|
44
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
25
45
|
|
26
46
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
27
47
|
haven't already, it will help you with organizing your files.
|
@@ -35,6 +55,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
35
55
|
[help-page]: http://exercism.io/languages/rust
|
36
56
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
37
57
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
58
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
38
59
|
{{ with .Spec.Credits }}
|
39
60
|
## Source
|
40
61
|
|
@@ -50,11 +50,31 @@ Execute the tests with:
|
|
50
50
|
$ cargo test
|
51
51
|
```
|
52
52
|
|
53
|
-
All but the first test have been ignored.
|
54
|
-
pass,
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
All but the first test have been ignored. After you get the first test to
|
54
|
+
pass, open the tests source file wich is located in the `tests` directory
|
55
|
+
and remove the `#[ignore]` flag from the next test and get the tests to pass
|
56
|
+
again. Each separate test is a function with `#[test]` flag above it.
|
57
|
+
Continue, until you pass every test.
|
58
|
+
|
59
|
+
If you wish to run all tests without editing the tests source file, use:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
$ cargo test -- --ignored
|
63
|
+
```
|
64
|
+
|
65
|
+
To run a specific test, for example `some_test`, you can use:
|
66
|
+
|
67
|
+
```bash
|
68
|
+
$ cargo test some_test
|
69
|
+
```
|
70
|
+
|
71
|
+
If the specfic test is ignored use:
|
72
|
+
|
73
|
+
```bash
|
74
|
+
$ cargo test some_test -- --ignored
|
75
|
+
```
|
76
|
+
|
77
|
+
To learn more about Rust tests refer to the [online test documentation][rust-tests]
|
58
78
|
|
59
79
|
Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
|
60
80
|
haven't already, it will help you with organizing your files.
|
@@ -68,6 +88,7 @@ If you want to know more about Exercism, take a look at the [contribution guide]
|
|
68
88
|
[help-page]: http://exercism.io/languages/rust
|
69
89
|
[modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
|
70
90
|
[cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
|
91
|
+
[rust-tests]: https://doc.rust-lang.org/book/second-edition/ch11-02-running-tests.html
|
71
92
|
|
72
93
|
## Source
|
73
94
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -1,9 +1,9 @@
|
|
1
1
|
extern crate accumulate;
|
2
2
|
|
3
|
-
use accumulate::{
|
3
|
+
use accumulate::{map_closure, map_function};
|
4
4
|
|
5
5
|
fn square(x: i32) -> i32 {
|
6
|
-
x*x
|
6
|
+
x * x
|
7
7
|
}
|
8
8
|
|
9
9
|
fn abs_val(x: i32) -> i32 {
|
@@ -58,7 +58,7 @@ fn test_func_abs_value_long() {
|
|
58
58
|
fn test_closure_square_single() {
|
59
59
|
let input = vec![2];
|
60
60
|
let expected = vec![4];
|
61
|
-
assert_eq!(map_closure(input, |x| x*x), expected);
|
61
|
+
assert_eq!(map_closure(input, |x| x * x), expected);
|
62
62
|
}
|
63
63
|
|
64
64
|
#[test]
|
@@ -66,7 +66,7 @@ fn test_closure_square_single() {
|
|
66
66
|
fn test_closure_square_short() {
|
67
67
|
let input = vec![2, 3, 4, 5];
|
68
68
|
let expected = vec![4, 9, 16, 25];
|
69
|
-
assert_eq!(map_closure(input, |x| x*x), expected);
|
69
|
+
assert_eq!(map_closure(input, |x| x * x), expected);
|
70
70
|
}
|
71
71
|
|
72
72
|
#[test]
|
@@ -74,7 +74,7 @@ fn test_closure_square_short() {
|
|
74
74
|
fn test_closure_square_long_with_neg() {
|
75
75
|
let input = vec![2, -3, -2, 3, 4, 3, 4, 5, 100, 8, 16, 34];
|
76
76
|
let expected = vec![4, 9, 4, 9, 16, 9, 16, 25, 10000, 64, 256, 1156];
|
77
|
-
assert_eq!(map_closure(input, |x| x*x), expected);
|
77
|
+
assert_eq!(map_closure(input, |x| x * x), expected);
|
78
78
|
}
|
79
79
|
|
80
80
|
#[test]
|
@@ -82,7 +82,7 @@ fn test_closure_square_long_with_neg() {
|
|
82
82
|
fn test_closure_abs_value_with_neg() {
|
83
83
|
let input = vec![-3];
|
84
84
|
let expected = vec![3];
|
85
|
-
assert_eq!(map_closure(input, |x| if x > 0 {x} else {-x}), expected);
|
85
|
+
assert_eq!(map_closure(input, |x| if x > 0 { x } else { -x }), expected);
|
86
86
|
}
|
87
87
|
|
88
88
|
#[test]
|
@@ -90,5 +90,5 @@ fn test_closure_abs_value_with_neg() {
|
|
90
90
|
fn test_closure_abs_value_long() {
|
91
91
|
let input = vec![-3, 5, -10, 4, 100, -1234, 55443];
|
92
92
|
let expected = vec![3, 5, 10, 4, 100, 1234, 55443];
|
93
|
-
assert_eq!(map_closure(input, |x| if x > 0 {x} else {-x}), expected);
|
93
|
+
assert_eq!(map_closure(input, |x| if x > 0 { x } else { -x }), expected);
|
94
94
|
}
|
@@ -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
|
+
|
@@ -2,13 +2,13 @@ extern crate acronym;
|
|
2
2
|
|
3
3
|
#[test]
|
4
4
|
fn basic() {
|
5
|
-
|
5
|
+
assert_eq!(acronym::abbreviate("Portable Network Graphics"), "PNG");
|
6
6
|
}
|
7
7
|
|
8
8
|
#[test]
|
9
9
|
#[ignore]
|
10
10
|
fn lowercase_words() {
|
11
|
-
|
11
|
+
assert_eq!(acronym::abbreviate("Ruby on Rails"), "ROR");
|
12
12
|
}
|
13
13
|
|
14
14
|
#[test]
|
@@ -32,12 +32,17 @@ fn all_caps_words() {
|
|
32
32
|
#[test]
|
33
33
|
#[ignore]
|
34
34
|
fn non_acronym_all_caps_word() {
|
35
|
-
assert_eq!(
|
35
|
+
assert_eq!(
|
36
|
+
acronym::abbreviate("GNU Image Manipulation Program"),
|
37
|
+
"GIMP"
|
38
|
+
);
|
36
39
|
}
|
37
40
|
|
38
41
|
#[test]
|
39
42
|
#[ignore]
|
40
43
|
fn hyphenated() {
|
41
|
-
assert_eq!(
|
42
|
-
|
44
|
+
assert_eq!(
|
45
|
+
acronym::abbreviate("Complementary metal-oxide semiconductor"),
|
46
|
+
"CMOS"
|
47
|
+
);
|
43
48
|
}
|
@@ -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
|
## Submitting Incomplete Solutions
|
67
88
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|