trackler 2.1.0.24 → 2.1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CONTRIBUTING.md +5 -8
- data/README.md +7 -7
- data/common/CONTRIBUTING.md +0 -5
- data/common/exercises/accumulate/description.md +4 -1
- data/common/exercises/acronym/description.md +1 -1
- data/common/exercises/bank-account/description.md +2 -1
- data/common/exercises/book-store/description.md +2 -5
- data/common/exercises/bracket-push/description.md +2 -4
- data/common/exercises/change/description.md +2 -5
- data/common/exercises/circular-buffer/description.md +0 -2
- data/common/exercises/clock/description.md +0 -2
- data/common/exercises/collatz-conjecture/canonical-data.json +36 -0
- data/common/exercises/collatz-conjecture/description.md +25 -0
- data/common/exercises/collatz-conjecture/metadata.yml +4 -0
- data/common/exercises/counter/description.md +1 -2
- data/common/exercises/diamond/description.md +0 -4
- data/common/exercises/flatten-array/description.md +1 -1
- data/common/exercises/grade-school/description.md +2 -1
- data/common/exercises/grains/description.md +2 -1
- data/common/exercises/grep/description.md +3 -2
- data/common/exercises/kindergarten-garden/description.md +2 -1
- data/common/exercises/largest-series-product/description.md +2 -1
- data/common/exercises/matrix/description.md +2 -1
- data/common/exercises/nucleotide-codons/description.md +2 -1
- data/common/exercises/ocr-numbers/description.md +2 -1
- data/common/exercises/octal/description.md +3 -1
- data/common/exercises/pangram/description.md +2 -1
- data/common/exercises/perfect-numbers/description.md +2 -1
- data/common/exercises/poker/description.md +0 -2
- data/common/exercises/protein-translation/description.md +3 -2
- data/common/exercises/proverb/description.md +2 -1
- data/common/exercises/pythagorean-triplet/description.md +4 -2
- data/common/exercises/queen-attack/description.md +2 -1
- data/common/exercises/rectangles/description.md +1 -3
- data/common/exercises/rotational-cipher/description.md +0 -4
- data/common/exercises/scale-generator/description.md +0 -2
- data/common/exercises/secret-handshake/description.md +2 -2
- data/common/exercises/series/description.md +2 -1
- data/common/exercises/sieve/description.md +2 -1
- data/common/exercises/space-age/description.md +0 -2
- data/common/exercises/strain/description.md +4 -5
- data/common/exercises/sublist/description.md +3 -6
- data/common/exercises/sum-of-multiples/description.md +2 -1
- data/common/exercises/tournament/description.md +4 -3
- data/common/exercises/transpose/description.md +1 -3
- data/common/exercises/trinary/description.md +2 -1
- data/common/exercises/two-bucket/description.md +1 -3
- data/common/exercises/two-fer/canonical-data.json +24 -0
- data/common/exercises/two-fer/description.md +40 -0
- data/common/exercises/two-fer/metadata.yml +4 -0
- data/common/exercises/word-search/description.md +2 -4
- data/common/exercises/zebra-puzzle/description.md +1 -1
- data/lib/trackler.rb +10 -5
- data/lib/trackler/description.rb +2 -2
- data/lib/trackler/guaranteed_file.rb +15 -15
- data/lib/trackler/implementation.rb +5 -5
- data/lib/trackler/implementations.rb +2 -2
- data/lib/trackler/metadata.rb +2 -2
- data/lib/trackler/problem.rb +2 -96
- data/lib/trackler/problems.rb +3 -48
- data/lib/trackler/specification.rb +101 -0
- data/lib/trackler/specifications.rb +52 -0
- data/lib/trackler/track.rb +6 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/LICENSE +21 -0
- data/tracks/bash/README.md +0 -5
- data/tracks/c/LICENSE +21 -0
- data/tracks/c/README.md +0 -5
- data/tracks/clojure/LICENSE +2 -2
- data/tracks/clojure/README.org +0 -5
- data/tracks/clojure/config.json +5 -0
- data/tracks/clojure/exercises/sublist/project.clj +4 -0
- data/tracks/clojure/exercises/sublist/src/example.clj +19 -0
- data/tracks/clojure/exercises/sublist/sublist.mustache +9 -0
- data/tracks/clojure/exercises/sublist/test/sublist_test.clj +40 -0
- data/tracks/cpp/LICENSE +2 -2
- data/tracks/cpp/README.md +0 -5
- data/tracks/csharp/LICENSE +2 -2
- data/tracks/csharp/README.md +0 -5
- data/tracks/delphi/LICENSE +2 -2
- data/tracks/delphi/README.md +0 -5
- data/tracks/ecmascript/LICENSE +2 -2
- data/tracks/ecmascript/README.md +0 -5
- data/tracks/elisp/.travis.yml +7 -3
- data/tracks/elisp/LICENSE +2 -2
- data/tracks/elisp/README.org +3 -6
- data/tracks/elisp/bin/test-examples +27 -0
- data/tracks/elisp/config.json +10 -0
- data/tracks/elisp/docs/LEARNING.org +0 -3
- data/tracks/elisp/exercises/grains/example.el +18 -0
- data/tracks/elisp/exercises/grains/grains-test.el +38 -0
- data/tracks/elisp/exercises/grains/grains.el +10 -0
- data/tracks/elisp/exercises/phone-number/example.el +34 -0
- data/tracks/elisp/exercises/phone-number/phone-number-test.el +43 -0
- data/tracks/elisp/exercises/phone-number/phone-number.el +9 -0
- data/tracks/elixir/LICENSE +2 -2
- data/tracks/elixir/README.md +0 -5
- data/tracks/elm/LICENSE +2 -2
- data/tracks/elm/README.md +0 -5
- data/tracks/erlang/LICENSE +2 -2
- data/tracks/erlang/README.md +0 -5
- data/tracks/erlang/SETUP.md +7 -0
- data/tracks/erlang/exercises/rotational-cipher/rebar.config +5 -5
- data/tracks/erlang/exercises/rotational-cipher/test/rotational_cipher_tests.erl +18 -18
- data/tracks/factor/LICENSE +2 -2
- data/tracks/fortran/.github/PULL_REQUEST_TEMPLATE.md +23 -0
- data/tracks/fortran/.gitignore +4 -0
- data/tracks/fortran/.travis.yml +17 -0
- data/tracks/fortran/LICENSE +21 -0
- data/tracks/fortran/Makefile +40 -0
- data/tracks/fortran/README.md +72 -0
- data/tracks/fortran/bin/fetch-configlet +32 -0
- data/tracks/fortran/config.json +32 -0
- data/tracks/{kotlin/SETUP.md → fortran/docs/ABOUT.md} +0 -0
- data/tracks/fortran/docs/INSTALLATION.md +0 -0
- data/tracks/fortran/docs/LEARNING.md +0 -0
- data/tracks/fortran/docs/RESOURCES.md +0 -0
- data/tracks/fortran/docs/TESTS.md +0 -0
- data/tracks/fortran/exercises/TRACK_HINTS.md +0 -0
- data/tracks/fortran/exercises/bob/bob.fun +114 -0
- data/tracks/fortran/exercises/bob/example.f90 +61 -0
- data/tracks/fortran/exercises/hello_world/example.f90 +9 -0
- data/tracks/fortran/exercises/hello_world/hello_world.fun +10 -0
- data/tracks/fortran/img/.keep +0 -0
- data/tracks/fsharp/LICENSE +2 -2
- data/tracks/fsharp/README.md +0 -5
- data/tracks/go/LICENSE +2 -2
- data/tracks/go/README.md +0 -5
- data/tracks/haskell/LICENSE +2 -2
- data/tracks/haskell/README.md +0 -5
- data/tracks/idris/LICENSE +2 -2
- data/tracks/idris/README.md +0 -5
- data/tracks/java/LICENSE +2 -2
- data/tracks/java/README.md +0 -7
- data/tracks/java/{SETUP.md → TRACK_HINTS.md} +0 -0
- data/tracks/java/config.json +5 -0
- data/tracks/java/exercises/_template/build.gradle +1 -0
- data/tracks/java/exercises/accumulate/build.gradle +1 -0
- data/tracks/java/exercises/acronym/build.gradle +1 -0
- data/tracks/java/exercises/all-your-base/build.gradle +1 -0
- data/tracks/java/exercises/allergies/build.gradle +1 -0
- data/tracks/java/exercises/anagram/build.gradle +1 -0
- data/tracks/java/exercises/atbash-cipher/build.gradle +1 -0
- data/tracks/java/exercises/beer-song/build.gradle +1 -0
- data/tracks/java/exercises/binary-search/build.gradle +1 -0
- data/tracks/java/exercises/binary/build.gradle +1 -0
- data/tracks/java/exercises/bob/build.gradle +1 -0
- data/tracks/java/exercises/book-store/build.gradle +1 -0
- data/tracks/java/exercises/bracket-push/build.gradle +1 -0
- data/tracks/java/exercises/change/build.gradle +1 -0
- data/tracks/java/exercises/clock/build.gradle +2 -1
- data/tracks/java/exercises/collatz-conjecture/build.gradle +18 -0
- data/tracks/java/exercises/collatz-conjecture/src/example/java/CollatzCalculator.java +19 -0
- data/tracks/java/exercises/collatz-conjecture/src/main/java/CollatzCalculator.java +7 -0
- data/tracks/java/exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java +59 -0
- data/tracks/java/exercises/crypto-square/build.gradle +1 -0
- data/tracks/java/exercises/diamond/build.gradle +1 -0
- data/tracks/java/exercises/diamond/src/example/java/DiamondPrinter.java +4 -4
- data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +6 -2
- data/tracks/java/exercises/difference-of-squares/build.gradle +1 -0
- data/tracks/java/exercises/difference-of-squares/src/main/java/.keep +0 -0
- data/tracks/java/exercises/etl/build.gradle +1 -0
- data/tracks/java/exercises/flatten-array/build.gradle +1 -0
- data/tracks/java/exercises/gigasecond/build.gradle +1 -0
- data/tracks/java/exercises/grade-school/build.gradle +1 -0
- data/tracks/java/exercises/hamming/build.gradle +1 -0
- data/tracks/java/exercises/hexadecimal/build.gradle +1 -0
- data/tracks/java/exercises/isogram/build.gradle +1 -0
- data/tracks/java/exercises/kindergarten-garden/build.gradle +1 -0
- data/tracks/java/exercises/largest-series-product/build.gradle +1 -0
- data/tracks/java/exercises/linked-list/build.gradle +1 -0
- data/tracks/java/exercises/luhn/build.gradle +1 -0
- data/tracks/java/exercises/matrix/build.gradle +2 -1
- data/tracks/java/exercises/meetup/build.gradle +1 -0
- data/tracks/java/exercises/minesweeper/build.gradle +1 -0
- data/tracks/java/exercises/nth-prime/build.gradle +1 -0
- data/tracks/java/exercises/ocr-numbers/build.gradle +1 -0
- data/tracks/java/exercises/octal/build.gradle +1 -0
- data/tracks/java/exercises/pangram/build.gradle +1 -0
- data/tracks/java/exercises/pascals-triangle/build.gradle +1 -0
- data/tracks/java/exercises/perfect-numbers/build.gradle +1 -0
- data/tracks/java/exercises/phone-number/build.gradle +1 -0
- data/tracks/java/exercises/pig-latin/build.gradle +1 -0
- data/tracks/java/exercises/queen-attack/build.gradle +1 -0
- data/tracks/java/exercises/raindrops/build.gradle +1 -0
- data/tracks/java/exercises/rectangles/build.gradle +1 -0
- data/tracks/java/exercises/rna-transcription/build.gradle +1 -0
- data/tracks/java/exercises/robot-simulator/build.gradle +1 -0
- data/tracks/java/exercises/roman-numerals/build.gradle +1 -0
- data/tracks/java/exercises/run-length-encoding/build.gradle +1 -0
- data/tracks/java/exercises/saddle-points/build.gradle +1 -0
- data/tracks/java/exercises/scrabble-score/build.gradle +1 -0
- data/tracks/java/exercises/secret-handshake/build.gradle +1 -0
- data/tracks/java/exercises/series/build.gradle +1 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/java/exercises/sieve/build.gradle +1 -0
- data/tracks/java/exercises/simple-cipher/build.gradle +1 -0
- data/tracks/java/exercises/simple-linked-list/build.gradle +1 -0
- data/tracks/java/exercises/space-age/build.gradle +1 -0
- data/tracks/java/exercises/strain/build.gradle +1 -0
- data/tracks/java/exercises/sublist/build.gradle +1 -0
- data/tracks/java/exercises/sum-of-multiples/build.gradle +1 -0
- data/tracks/java/exercises/triangle/build.gradle +1 -0
- data/tracks/java/exercises/trinary/build.gradle +1 -0
- data/tracks/java/exercises/twelve-days/build.gradle +2 -1
- data/tracks/java/exercises/word-count/build.gradle +1 -0
- data/tracks/java/exercises/wordy/build.gradle +1 -0
- data/tracks/javascript/LICENSE +2 -2
- data/tracks/javascript/README.md +0 -5
- data/tracks/julia/LICENSE +2 -2
- data/tracks/kotlin/LICENSE +2 -2
- data/tracks/kotlin/README.md +0 -7
- data/tracks/kotlin/TRACK_HINTS.md +1 -0
- data/tracks/kotlin/exercises/phone-number/src/example/kotlin/PhoneNumber.kt +1 -1
- data/tracks/kotlin/exercises/phone-number/src/test/kotlin/PhoneNumberTest.kt +7 -8
- data/tracks/kotlin/exercises/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt +6 -6
- data/tracks/lfe/LICENSE +2 -2
- data/tracks/lfe/README.md +0 -5
- data/tracks/lisp/LICENSE +2 -2
- data/tracks/lisp/README.md +0 -5
- data/tracks/lua/LICENSE +2 -2
- data/tracks/lua/README.md +0 -5
- data/tracks/mips/LICENSE +2 -2
- data/tracks/mips/README.md +0 -5
- data/tracks/objective-c/LICENSE +2 -2
- data/tracks/objective-c/README.md +0 -5
- data/tracks/ocaml/LICENSE +2 -2
- data/tracks/ocaml/README.md +0 -5
- data/tracks/ocaml/config.json +54 -25
- data/tracks/ocaml/exercises/forth/.merlin +5 -0
- data/tracks/ocaml/exercises/forth/Makefile +11 -0
- data/tracks/ocaml/exercises/forth/example.ml +89 -0
- data/tracks/ocaml/exercises/forth/forth.mli +1 -0
- data/tracks/ocaml/exercises/forth/test.ml +147 -0
- data/tracks/ocaml/exercises/react/.merlin +5 -0
- data/tracks/ocaml/exercises/react/HINT.md +3 -0
- data/tracks/ocaml/exercises/react/Makefile +11 -0
- data/tracks/ocaml/exercises/react/example.ml +106 -0
- data/tracks/ocaml/exercises/react/react.mli +26 -0
- data/tracks/ocaml/exercises/react/test.ml +157 -0
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +5 -2
- data/tracks/ocaml/tools/test-generator/templates/forth/template.ml +114 -0
- data/tracks/perl5/LICENSE +2 -2
- data/tracks/perl6/LICENSE +2 -2
- data/tracks/perl6/README.md +0 -5
- data/tracks/perl6/config.json +5 -0
- data/tracks/perl6/exercises/clock/Example.pm6 +2 -2
- data/tracks/perl6/exercises/flatten-array/Example.pm6 +13 -0
- data/tracks/perl6/exercises/flatten-array/FlattenArray.pm6 +4 -0
- data/tracks/perl6/exercises/flatten-array/example.yaml +6 -0
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +80 -0
- data/tracks/php/LICENSE +2 -2
- data/tracks/php/README.md +0 -5
- data/tracks/powershell/.travis.yml +1 -0
- data/tracks/python/LICENSE +2 -2
- data/tracks/python/README.md +0 -5
- data/tracks/python/config.json +8 -0
- data/tracks/python/exercises/protein-translation/example.py +25 -0
- data/tracks/python/exercises/protein-translation/protein_translation.py +6 -0
- data/tracks/python/exercises/protein-translation/protein_translation_test.py +59 -0
- data/tracks/r/LICENSE +2 -2
- data/tracks/r/README.md +0 -5
- data/tracks/racket/LICENSE +2 -2
- data/tracks/racket/README.md +0 -5
- data/tracks/racket/config.json +5 -0
- data/tracks/racket/exercises/acronym/acronym-test.rkt +40 -0
- data/tracks/racket/exercises/acronym/acronym.rkt +3 -0
- data/tracks/racket/exercises/acronym/example.rkt +25 -0
- data/tracks/racket/exercises/grep/example.rkt +60 -26
- data/tracks/racket/exercises/grep/grep-test.rkt +154 -17
- data/tracks/racket/exercises/grep/grep.rkt +1 -18
- data/tracks/racket/exercises/grep/iliad.txt +9 -0
- data/tracks/racket/exercises/grep/midsummer-night.txt +7 -0
- data/tracks/racket/exercises/grep/paradise-lost.txt +8 -0
- data/tracks/ruby/README.md +4 -1
- data/tracks/ruby/exercises/acronym/.meta/.version +1 -1
- data/tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb +1 -1
- data/tracks/ruby/exercises/acronym/acronym_test.rb +2 -7
- data/tracks/ruby/exercises/anagram/.meta/generator/anagram_case.rb +1 -1
- data/tracks/ruby/exercises/beer-song/.meta/generator/beer_song_case.rb +1 -1
- data/tracks/ruby/exercises/clock/.meta/generator/clock_case.rb +1 -1
- data/tracks/ruby/exercises/connect/.meta/generator/connect_case.rb +0 -3
- data/tracks/ruby/exercises/connect/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/difference-of-squares/.meta/.version +1 -1
- data/tracks/ruby/exercises/difference-of-squares/.meta/solutions/difference_of_squares.rb +1 -1
- data/tracks/ruby/exercises/difference-of-squares/difference_of_squares_test.rb +12 -17
- data/tracks/ruby/exercises/triangle/.meta/generator/triangle_case.rb +10 -2
- data/tracks/ruby/exercises/triangle/triangle_test.rb +17 -17
- data/tracks/ruby/exercises/wordy/.meta/generator/wordy_case.rb +1 -1
- data/tracks/ruby/lib/generator/case_values.rb +1 -1
- data/tracks/ruby/lib/generator/exercise_case.rb +16 -2
- data/tracks/ruby/lib/generator/exercise_case/assertion.rb +4 -4
- data/tracks/ruby/test/fixtures/xruby/exercises/alpha/.meta/generator/alpha_case.rb +1 -1
- data/tracks/ruby/test/generator/case_values_test.rb +28 -7
- data/tracks/ruby/test/generator/exercise_case/assertion_test.rb +7 -7
- data/tracks/ruby/test/generator/exercise_case_test.rb +21 -25
- data/tracks/ruby/test/wordy_cases_test.rb +4 -4
- data/tracks/rust/LICENSE +2 -2
- data/tracks/rust/README.md +0 -5
- data/tracks/rust/config.json +1 -0
- data/tracks/rust/exercises/etl/Cargo.toml +1 -1
- data/tracks/rust/exercises/etl/example.rs +2 -2
- data/tracks/rust/exercises/etl/tests/etl.rs +26 -32
- data/tracks/rust/exercises/forth/tests/forth.rs +20 -22
- data/tracks/rust/exercises/minesweeper/Cargo.toml +1 -1
- data/tracks/rust/exercises/minesweeper/example.rs +3 -0
- data/tracks/rust/exercises/minesweeper/tests/minesweeper.rs +44 -46
- data/tracks/rust/exercises/raindrops/Cargo.toml +1 -1
- data/tracks/rust/exercises/raindrops/tests/raindrops.rs +12 -0
- data/tracks/rust/exercises/rna-transcription/Cargo.toml +1 -1
- data/tracks/rust/exercises/rna-transcription/example.rs +13 -9
- data/tracks/rust/exercises/rna-transcription/tests/rna-transcription.rs +23 -5
- data/tracks/scala/LICENSE +2 -2
- data/tracks/scala/README.md +0 -5
- data/tracks/scheme/LICENSE +2 -2
- data/tracks/scheme/README.org +0 -6
- data/tracks/swift/Dangerfile +1 -1
- data/tracks/swift/LICENSE +2 -2
- data/tracks/swift/README.md +0 -6
- data/tracks/vbnet/.travis.yml +1 -0
- data/tracks/vimscript/.travis.yml +4 -0
- data/tracks/vimscript/.vintrc.yaml +5 -0
- data/tracks/vimscript/TRACK_HINTS.md +19 -1
- data/tracks/vimscript/bin/pre-push +18 -0
- data/tracks/vimscript/config.json +8 -1
- data/tracks/vimscript/docs/ABOUT.md +7 -6
- data/tracks/vimscript/docs/TESTS.md +4 -4
- data/tracks/vimscript/exercises/allergies/allergies.vader +68 -0
- data/tracks/vimscript/exercises/allergies/allergies.vim +29 -0
- data/tracks/vimscript/exercises/allergies/example.vim +23 -0
- data/tracks/vimscript/lib/generate.vim +89 -0
- metadata +81 -6
- data/tracks/java/exercises/difference-of-squares/src/main/java/DifferenceOfSquaresCalculator.java +0 -15
- data/tracks/ocaml/.vscode/launch.json +0 -13
@@ -36,6 +36,9 @@ impl Board {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
pub fn annotate(pieces: &[&str]) -> Vec<String> {
|
39
|
+
if pieces.len() == 0 {
|
40
|
+
return Vec::new();
|
41
|
+
}
|
39
42
|
let pieces_vec = pieces.iter().map(|&r| r.chars().collect()).collect();
|
40
43
|
Board {pieces: pieces_vec, num_rows: pieces.len(), num_cols: pieces[0].len()}.annotated()
|
41
44
|
}
|
@@ -21,98 +21,93 @@ fn run_test(test_case: &[&str]) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
#[test]
|
24
|
-
fn
|
24
|
+
fn no_rows() {
|
25
25
|
run_test(&[
|
26
|
-
" ",
|
27
|
-
" ",
|
28
|
-
" "
|
29
26
|
]);
|
30
27
|
}
|
31
28
|
|
32
29
|
#[test]
|
33
30
|
#[ignore]
|
34
|
-
fn
|
31
|
+
fn no_columns() {
|
35
32
|
run_test(&[
|
36
|
-
"
|
37
|
-
"***",
|
38
|
-
"***"
|
33
|
+
"",
|
39
34
|
]);
|
40
35
|
}
|
41
36
|
|
42
37
|
#[test]
|
43
38
|
#[ignore]
|
44
|
-
fn
|
39
|
+
fn no_mines() {
|
45
40
|
run_test(&[
|
46
|
-
"
|
41
|
+
" ",
|
42
|
+
" ",
|
43
|
+
" ",
|
47
44
|
]);
|
48
45
|
}
|
49
46
|
|
50
47
|
#[test]
|
51
48
|
#[ignore]
|
52
|
-
fn
|
49
|
+
fn board_with_only_mines() {
|
53
50
|
run_test(&[
|
54
|
-
"
|
51
|
+
"***",
|
52
|
+
"***",
|
53
|
+
"***",
|
55
54
|
]);
|
56
55
|
}
|
57
56
|
|
58
57
|
#[test]
|
59
58
|
#[ignore]
|
60
|
-
fn
|
59
|
+
fn mine_surrounded_by_spaces() {
|
61
60
|
run_test(&[
|
62
|
-
"
|
61
|
+
"111",
|
62
|
+
"1*1",
|
63
|
+
"111",
|
63
64
|
]);
|
64
65
|
}
|
65
66
|
|
66
67
|
#[test]
|
67
68
|
#[ignore]
|
68
|
-
fn
|
69
|
+
fn space_surrounded_by_mines() {
|
69
70
|
run_test(&[
|
70
|
-
"
|
71
|
+
"***",
|
72
|
+
"*8*",
|
73
|
+
"***",
|
71
74
|
]);
|
72
75
|
}
|
73
76
|
|
74
77
|
#[test]
|
75
78
|
#[ignore]
|
76
|
-
fn
|
79
|
+
fn horizontal_line() {
|
77
80
|
run_test(&[
|
78
|
-
"
|
79
|
-
"1",
|
80
|
-
"*",
|
81
|
-
"1",
|
82
|
-
" ",
|
81
|
+
"1*2*1",
|
83
82
|
]);
|
84
83
|
}
|
85
84
|
|
86
85
|
#[test]
|
87
86
|
#[ignore]
|
88
|
-
fn
|
87
|
+
fn horizontal_line_mines_at_edges() {
|
89
88
|
run_test(&[
|
90
|
-
" ",
|
91
|
-
"1",
|
92
|
-
"*",
|
93
|
-
"2",
|
94
|
-
"*",
|
95
|
-
"1",
|
96
|
-
" ",
|
89
|
+
"*1 1*",
|
97
90
|
]);
|
98
91
|
}
|
99
92
|
|
100
93
|
#[test]
|
101
94
|
#[ignore]
|
102
|
-
fn
|
95
|
+
fn vertical_line() {
|
103
96
|
run_test(&[
|
97
|
+
"1",
|
98
|
+
"*",
|
99
|
+
"2",
|
104
100
|
"*",
|
105
101
|
"1",
|
106
|
-
" ",
|
107
|
-
" ",
|
108
102
|
]);
|
109
103
|
}
|
110
104
|
|
111
105
|
#[test]
|
112
106
|
#[ignore]
|
113
|
-
fn
|
107
|
+
fn vertical_line_mines_at_edges() {
|
114
108
|
run_test(&[
|
115
|
-
"
|
109
|
+
"*",
|
110
|
+
"1",
|
116
111
|
" ",
|
117
112
|
"1",
|
118
113
|
"*",
|
@@ -121,22 +116,25 @@ fn one_vertical_row_with_one_mine_at_the_bottom() {
|
|
121
116
|
|
122
117
|
#[test]
|
123
118
|
#[ignore]
|
124
|
-
fn
|
119
|
+
fn cross() {
|
125
120
|
run_test(&[
|
126
|
-
"
|
127
|
-
"*
|
128
|
-
"
|
121
|
+
" 2*2 ",
|
122
|
+
"25*52",
|
123
|
+
"*****",
|
124
|
+
"25*52",
|
125
|
+
" 2*2 ",
|
129
126
|
]);
|
130
127
|
}
|
131
128
|
|
132
129
|
#[test]
|
133
130
|
#[ignore]
|
134
|
-
fn
|
131
|
+
fn large_board() {
|
135
132
|
run_test(&[
|
136
|
-
"
|
137
|
-
"
|
138
|
-
"
|
139
|
-
"
|
140
|
-
"
|
133
|
+
"1*22*1",
|
134
|
+
"12*322",
|
135
|
+
" 123*2",
|
136
|
+
"112*4*",
|
137
|
+
"1*22*2",
|
138
|
+
"111111",
|
141
139
|
]);
|
142
|
-
}
|
140
|
+
}
|
@@ -19,6 +19,10 @@ fn test_7() { assert_eq!("Plong", raindrops::raindrops(7)); }
|
|
19
19
|
#[ignore]
|
20
20
|
fn test_6() { assert_eq!("Pling", raindrops::raindrops(6)); }
|
21
21
|
|
22
|
+
#[test]
|
23
|
+
#[ignore]
|
24
|
+
fn test_8() { assert_eq!("8", raindrops::raindrops(8)); }
|
25
|
+
|
22
26
|
#[test]
|
23
27
|
#[ignore]
|
24
28
|
fn test_9() { assert_eq!("Pling", raindrops::raindrops(9)); }
|
@@ -43,6 +47,10 @@ fn test_21() { assert_eq!("PlingPlong", raindrops::raindrops(21)); }
|
|
43
47
|
#[ignore]
|
44
48
|
fn test_25() { assert_eq!("Plang", raindrops::raindrops(25)); }
|
45
49
|
|
50
|
+
#[test]
|
51
|
+
#[ignore]
|
52
|
+
fn test_27() { assert_eq!("Pling", raindrops::raindrops(27)); }
|
53
|
+
|
46
54
|
#[test]
|
47
55
|
#[ignore]
|
48
56
|
fn test_35() { assert_eq!("PlangPlong", raindrops::raindrops(35)); }
|
@@ -59,6 +67,10 @@ fn test_52() { assert_eq!("52", raindrops::raindrops(52)); }
|
|
59
67
|
#[ignore]
|
60
68
|
fn test_105() { assert_eq!("PlingPlangPlong", raindrops::raindrops(105)); }
|
61
69
|
|
70
|
+
#[test]
|
71
|
+
#[ignore]
|
72
|
+
fn test_3125() { assert_eq!("Plang", raindrops::raindrops(3125)); }
|
73
|
+
|
62
74
|
#[test]
|
63
75
|
#[ignore]
|
64
76
|
fn test_12121() { assert_eq!("12121", raindrops::raindrops(12121)); }
|
@@ -14,13 +14,13 @@ pub struct DeoxyribonucleicAcid {
|
|
14
14
|
nucleotides: String
|
15
15
|
}
|
16
16
|
|
17
|
-
fn transcribe_dna_rna(c: char) -> char {
|
17
|
+
fn transcribe_dna_rna(c: char) -> Option<char> {
|
18
18
|
match c {
|
19
|
-
'C' => 'G',
|
20
|
-
'G' => 'C',
|
21
|
-
'A' => 'U',
|
22
|
-
'T' => 'A',
|
23
|
-
_ =>
|
19
|
+
'C' => Some('G'),
|
20
|
+
'G' => Some('C'),
|
21
|
+
'A' => Some('U'),
|
22
|
+
'T' => Some('A'),
|
23
|
+
_ => None
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
@@ -29,8 +29,12 @@ impl DeoxyribonucleicAcid {
|
|
29
29
|
DeoxyribonucleicAcid { nucleotides: nucleotides.to_string() }
|
30
30
|
}
|
31
31
|
|
32
|
-
pub fn to_rna(&self) -> RibonucleicAcid {
|
33
|
-
let rna_nucleotides = self.nucleotides.chars().
|
34
|
-
|
32
|
+
pub fn to_rna(&self) -> Result<RibonucleicAcid, ()> {
|
33
|
+
let rna_nucleotides: String = self.nucleotides.chars().filter_map(transcribe_dna_rna).collect();
|
34
|
+
if rna_nucleotides.len() == self.nucleotides.len() {
|
35
|
+
Ok(RibonucleicAcid { nucleotides: rna_nucleotides })
|
36
|
+
} else {
|
37
|
+
Err(())
|
38
|
+
}
|
35
39
|
}
|
36
40
|
}
|
@@ -9,29 +9,47 @@ fn test_acid_equals_acid() {
|
|
9
9
|
#[test]
|
10
10
|
#[ignore]
|
11
11
|
fn test_transcribes_cytosine_guanine() {
|
12
|
-
assert_eq!(dna::RibonucleicAcid::new("G"), dna::DeoxyribonucleicAcid::new("C").to_rna());
|
12
|
+
assert_eq!(Ok(dna::RibonucleicAcid::new("G")), dna::DeoxyribonucleicAcid::new("C").to_rna());
|
13
13
|
}
|
14
14
|
|
15
15
|
#[test]
|
16
16
|
#[ignore]
|
17
17
|
fn test_transcribes_guanine_cytosine() {
|
18
|
-
assert_eq!(dna::RibonucleicAcid::new("C"), dna::DeoxyribonucleicAcid::new("G").to_rna());
|
18
|
+
assert_eq!(Ok(dna::RibonucleicAcid::new("C")), dna::DeoxyribonucleicAcid::new("G").to_rna());
|
19
19
|
}
|
20
20
|
|
21
21
|
#[test]
|
22
22
|
#[ignore]
|
23
23
|
fn test_transcribes_adenine_uracil() {
|
24
|
-
assert_eq!(dna::RibonucleicAcid::new("U"), dna::DeoxyribonucleicAcid::new("A").to_rna());
|
24
|
+
assert_eq!(Ok(dna::RibonucleicAcid::new("U")), dna::DeoxyribonucleicAcid::new("A").to_rna());
|
25
25
|
}
|
26
26
|
|
27
27
|
#[test]
|
28
28
|
#[ignore]
|
29
29
|
fn test_transcribes_thymine_to_adenine() {
|
30
|
-
assert_eq!(dna::RibonucleicAcid::new("A"), dna::DeoxyribonucleicAcid::new("T").to_rna());
|
30
|
+
assert_eq!(Ok(dna::RibonucleicAcid::new("A")), dna::DeoxyribonucleicAcid::new("T").to_rna());
|
31
31
|
}
|
32
32
|
|
33
33
|
#[test]
|
34
34
|
#[ignore]
|
35
35
|
fn test_transcribes_all_dna_to_rna() {
|
36
|
-
assert_eq!(dna::RibonucleicAcid::new("UGCACCAGAAUU"), dna::DeoxyribonucleicAcid::new("ACGTGGTCTTAA").to_rna())
|
36
|
+
assert_eq!(Ok(dna::RibonucleicAcid::new("UGCACCAGAAUU")), dna::DeoxyribonucleicAcid::new("ACGTGGTCTTAA").to_rna())
|
37
|
+
}
|
38
|
+
|
39
|
+
#[test]
|
40
|
+
#[ignore]
|
41
|
+
fn handles_invalid_input() {
|
42
|
+
assert!(dna::DeoxyribonucleicAcid::new("U").to_rna().is_err());
|
43
|
+
}
|
44
|
+
|
45
|
+
#[test]
|
46
|
+
#[ignore]
|
47
|
+
fn handles_completely_invalid_input() {
|
48
|
+
assert!(dna::DeoxyribonucleicAcid::new("XXX").to_rna().is_err());
|
49
|
+
}
|
50
|
+
|
51
|
+
#[test]
|
52
|
+
#[ignore]
|
53
|
+
fn handles_partially_invalid_input() {
|
54
|
+
assert!(dna::DeoxyribonucleicAcid::new("ACGTXXXCTTAA").to_rna().is_err());
|
37
55
|
}
|
data/tracks/scala/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2017 Exercism, Inc
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/tracks/scala/README.md
CHANGED
@@ -44,11 +44,6 @@ Please submit changes to a single problem per pull request unless you're
|
|
44
44
|
submitting a general change across many of the problems (e.g. formatting).
|
45
45
|
|
46
46
|
|
47
|
-
## License
|
48
|
-
|
49
|
-
The MIT License (MIT)
|
50
|
-
|
51
|
-
Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
|
52
47
|
|
53
48
|
## Scala icon
|
54
49
|
The Scala icon used on Exercism is inspired by the official Scala logo, which is copyright École Polytechnique Fédérale de Lausanne.
|
data/tracks/scheme/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2017 Exercism, Inc
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/tracks/scheme/README.org
CHANGED
@@ -32,12 +32,6 @@ upon.
|
|
32
32
|
|
33
33
|
Please see the [[https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data][contributing guide]]
|
34
34
|
|
35
|
-
** License
|
36
|
-
|
37
|
-
The MIT License (MIT)
|
38
|
-
|
39
|
-
Copyright (c) 2014 Katrina Owen, [[mailto:_@kytrinyx.com][_@kytrinyx.com]]
|
40
|
-
|
41
35
|
** Scheme icon
|
42
36
|
|
43
37
|
The Scheme logo was created by [[Matthias.f at en.wikipedia][https://en.wikipedia.org/wiki/User:Matthias.f]] and released under the Creative Commons Attribution-Share Alike 3.0 Unported license.
|
data/tracks/swift/Dangerfile
CHANGED
@@ -38,7 +38,7 @@ json.each do |object|
|
|
38
38
|
line = object["line"] || 1
|
39
39
|
#only warn for files that were edited in this PR.
|
40
40
|
if isError
|
41
|
-
|
41
|
+
warn(msg, file: "/" + shortFile, line: line) if isError
|
42
42
|
elsif git.modified_files.include? shortFile
|
43
43
|
warn(msg, file: "/" + shortFile, line: line) unless isError
|
44
44
|
else
|
data/tracks/swift/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2017 Exercism, Inc
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/tracks/swift/README.md
CHANGED
@@ -9,9 +9,3 @@ Please see the [contributing guide](https://github.com/exercism/x-api/blob/maste
|
|
9
9
|
## Swift Track
|
10
10
|
|
11
11
|
We use Travis CI to automatically run all the unit tests on the code that is going to be checked in. In addition we also have [SwiftLint](https://github.com/realm/SwiftLint) set up to make sure that the code is consistent across all exercises. Please run `swiftlint autocorrect --format` on your code before submitting a PR. Check the travis file to see which version of swift we are testing against. Make sure all the tests pass locally using the swift package manager. Keep in mind that we support Linux so the tests need to also pass on linux on Travis.
|
12
|
-
|
13
|
-
## License
|
14
|
-
|
15
|
-
The MIT License (MIT)
|
16
|
-
|
17
|
-
Copyright (c) 2017 Katrina Owen, _@kytrinyx.com
|
data/tracks/vbnet/.travis.yml
CHANGED
@@ -64,10 +64,28 @@ the `:Test` command.
|
|
64
64
|
|
65
65
|
## Writing tests
|
66
66
|
|
67
|
+
#### Generate test files
|
68
|
+
|
69
|
+
Use the [generator](lib/generate.vim) to create Vader files from their canonical
|
70
|
+
test data:
|
71
|
+
|
72
|
+
```vim
|
73
|
+
" in Vim
|
74
|
+
:source lib/generate.vim
|
75
|
+
:Generate word-count
|
76
|
+
```
|
77
|
+
|
78
|
+
This would fetch the [canonical test data](https://raw.githubusercontent.com/exercism/x-common/master/exercises/word-count/canonical-data.json),
|
79
|
+
decode the JSON to Vim data types, iterate over the result, and put the tests in
|
80
|
+
a new unnamed buffer.
|
81
|
+
|
82
|
+
_This script requires Vim 7.4.1304+ for `json_decode()`. It also relies on the
|
83
|
+
netrw plugin (`:h netrw`), but that one is shipped and sourced by default._
|
84
|
+
|
67
85
|
#### Type mismatch exceptions
|
68
86
|
|
69
87
|
Older Vims don't like changing types for the same variable. If your tests use
|
70
|
-
global variables, unlet them in a `Before` block at the top of the Vader file.
|
88
|
+
global variables, `unlet!` them in a `Before` block at the top of the Vader file.
|
71
89
|
|
72
90
|
When each test uses `let expected = ...`, then put this at the top:
|
73
91
|
|