trackler 2.2.1.91 → 2.2.1.92
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/problem-specifications/exercises/diamond/metadata.yml +1 -1
- data/problem-specifications/exercises/food-chain/canonical-data.json +42 -22
- data/problem-specifications/exercises/hello-world/canonical-data.json +2 -1
- data/problem-specifications/exercises/isbn-verifier/metadata.yml +2 -1
- data/problem-specifications/exercises/largest-series-product/canonical-data.json +62 -33
- data/problem-specifications/exercises/leap/canonical-data.json +14 -6
- data/problem-specifications/exercises/list-ops/canonical-data.json +6 -6
- data/problem-specifications/exercises/markdown/canonical-data.json +29 -11
- data/problem-specifications/exercises/minesweeper/canonical-data.json +80 -56
- data/problem-specifications/exercises/minesweeper/metadata.yml +1 -1
- data/problem-specifications/exercises/nth-prime/canonical-data.json +20 -8
- data/problem-specifications/exercises/nucleotide-count/canonical-data.json +17 -7
- data/problem-specifications/exercises/pascals-triangle/canonical-data.json +28 -10
- data/problem-specifications/exercises/perfect-numbers/canonical-data.json +41 -15
- data/problem-specifications/exercises/phone-number/canonical-data.json +44 -16
- data/problem-specifications/exercises/pig-latin/canonical-data.json +68 -24
- data/problem-specifications/exercises/reverse-string/metadata.yml +1 -1
- data/problem-specifications/exercises/rna-transcription/canonical-data.json +17 -7
- data/problem-specifications/exercises/roman-numerals/canonical-data.json +56 -20
- data/problem-specifications/exercises/rotational-cipher/canonical-data.json +42 -22
- data/problem-specifications/exercises/saddle-points/canonical-data.json +34 -24
- data/problem-specifications/exercises/scrabble-score/canonical-data.json +35 -13
- data/problem-specifications/exercises/secret-handshake/canonical-data.json +34 -12
- data/problem-specifications/exercises/sieve/canonical-data.json +16 -6
- data/problem-specifications/exercises/space-age/canonical-data.json +34 -18
- data/problem-specifications/exercises/spiral-matrix/canonical-data.json +19 -7
- data/problem-specifications/exercises/sublist/canonical-data.json +69 -35
- data/problem-specifications/exercises/twelve-days/canonical-data.json +61 -31
- data/problem-specifications/exercises/variable-length-quantity/canonical-data.json +79 -27
- data/problem-specifications/exercises/zebra-puzzle/canonical-data.json +3 -1
- data/tracks/csharp/exercises/accumulate/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/allergies/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/alphametics/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/bank-account/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/beer-song/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/clock/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/custom-set/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/diamond/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/difference-of-squares/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/diffie-hellman/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/dot-dsl/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/food-chain/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/forth/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/hangman/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/house/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/list-ops/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/markdown/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/nth-prime/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/nucleotide-count/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/palindrome-products/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/proverb/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/react/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/roman-numerals/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/saddle-points/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/sgf-parsing/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/simple-linked-list/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/sublist/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/sum-of-multiples/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/twelve-days/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/variable-length-quantity/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/word-search/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/wordy/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/zebra-puzzle/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/csharp/exercises/zipper/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/delphi/exercises/secret-handshake/uTestSecretHandshake.pas +1 -1
- data/tracks/elixir/config/exercise_readme.go.tmpl +34 -4
- data/tracks/elixir/exercises/accumulate/README.md +1 -6
- data/tracks/elixir/exercises/acronym/README.md +1 -4
- data/tracks/elixir/exercises/all-your-base/README.md +2 -5
- data/tracks/elixir/exercises/allergies/README.md +1 -4
- data/tracks/elixir/exercises/anagram/README.md +1 -3
- data/tracks/elixir/exercises/atbash-cipher/README.md +3 -4
- data/tracks/elixir/exercises/bank-account/README.md +1 -4
- data/tracks/elixir/exercises/beer-song/README.md +3 -5
- data/tracks/elixir/exercises/binary-search-tree/README.md +43 -0
- data/tracks/elixir/exercises/binary-search/README.md +1 -3
- data/tracks/elixir/exercises/binary/README.md +3 -3
- data/tracks/elixir/exercises/bob/README.md +2 -2
- data/tracks/elixir/exercises/bowling/README.md +21 -9
- data/tracks/elixir/exercises/bracket-push/README.md +1 -3
- data/tracks/elixir/exercises/change/README.md +2 -4
- data/tracks/elixir/exercises/clock/README.md +1 -3
- data/tracks/elixir/exercises/collatz-conjecture/README.md +2 -4
- data/tracks/elixir/exercises/connect/README.md +2 -5
- data/tracks/elixir/exercises/crypto-square/README.md +11 -11
- data/tracks/elixir/exercises/custom-set/README.md +1 -4
- data/tracks/elixir/exercises/diamond/README.md +7 -9
- data/tracks/elixir/exercises/difference-of-squares/README.md +1 -3
- data/tracks/elixir/exercises/diffie-hellman/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/elixir/exercises/diffie-hellman/README.md +1 -3
- data/tracks/elixir/exercises/dominoes/README.md +4 -7
- data/tracks/elixir/exercises/dot-dsl/README.md +2 -5
- data/tracks/elixir/exercises/etl/README.md +4 -4
- data/tracks/elixir/exercises/flatten-array/README.md +2 -5
- data/tracks/elixir/exercises/forth/README.md +1 -4
- data/tracks/elixir/exercises/gigasecond/README.md +1 -3
- data/tracks/elixir/exercises/grade-school/README.md +1 -4
- data/tracks/elixir/exercises/grains/README.md +1 -4
- data/tracks/elixir/exercises/grep/README.md +13 -15
- data/tracks/elixir/exercises/hamming/README.md +1 -3
- data/tracks/elixir/exercises/hello-world/README.md +23 -0
- data/tracks/elixir/exercises/hexadecimal/README.md +1 -3
- data/tracks/elixir/exercises/isbn-verifier/README.md +26 -24
- data/tracks/elixir/exercises/isogram/README.md +3 -4
- data/tracks/elixir/exercises/kindergarten-garden/README.md +14 -16
- data/tracks/elixir/exercises/largest-series-product/README.md +1 -3
- data/tracks/elixir/exercises/leap/README.md +2 -4
- data/tracks/elixir/exercises/list-ops/README.md +1 -4
- data/tracks/elixir/exercises/luhn/README.md +8 -10
- data/tracks/elixir/exercises/markdown/README.md +1 -4
- data/tracks/elixir/exercises/matrix/README.md +7 -7
- data/tracks/elixir/exercises/meetup/README.md +17 -16
- data/tracks/elixir/exercises/minesweeper/README.md +1 -4
- data/tracks/elixir/exercises/nth-prime/README.md +1 -3
- data/tracks/elixir/exercises/nucleotide-count/README.md +9 -25
- data/tracks/elixir/exercises/ocr-numbers/README.md +7 -9
- data/tracks/elixir/exercises/palindrome-products/README.md +16 -19
- data/tracks/elixir/exercises/pangram/README.md +2 -4
- data/tracks/elixir/exercises/parallel-letter-frequency/README.md +1 -4
- data/tracks/elixir/exercises/pascals-triangle/README.md +3 -5
- data/tracks/elixir/exercises/perfect-numbers/README.md +3 -5
- data/tracks/elixir/exercises/phone-number/README.md +5 -6
- data/tracks/elixir/exercises/pig-latin/README.md +1 -3
- data/tracks/elixir/exercises/poker/README.md +1 -3
- data/tracks/elixir/exercises/prime-factors/README.md +1 -3
- data/tracks/elixir/exercises/protein-translation/README.md +3 -6
- data/tracks/elixir/exercises/pythagorean-triplet/README.md +4 -6
- data/tracks/elixir/exercises/queen-attack/README.md +2 -4
- data/tracks/elixir/exercises/rail-fence-cipher/README.md +13 -10
- data/tracks/elixir/exercises/raindrops/README.md +1 -3
- data/tracks/elixir/exercises/rna-transcription/README.md +2 -4
- data/tracks/elixir/exercises/robot-simulator/README.md +1 -3
- data/tracks/elixir/exercises/roman-numerals/README.md +2 -4
- data/tracks/elixir/exercises/rotational-cipher/README.md +3 -4
- data/tracks/elixir/exercises/run-length-encoding/README.md +5 -7
- data/tracks/elixir/exercises/saddle-points/README.md +3 -5
- data/tracks/elixir/exercises/say/README.md +1 -3
- data/tracks/elixir/exercises/scale-generator/README.md +1 -5
- data/tracks/elixir/exercises/scrabble-score/README.md +4 -4
- data/tracks/elixir/exercises/secret-handshake/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/elixir/exercises/secret-handshake/README.md +4 -4
- data/tracks/elixir/exercises/series/README.md +1 -3
- data/tracks/elixir/exercises/sieve/README.md +1 -3
- data/tracks/elixir/exercises/simple-cipher/README.md +6 -10
- data/tracks/elixir/exercises/simple-linked-list/README.md +1 -3
- data/tracks/elixir/exercises/space-age/README.md +2 -4
- data/tracks/elixir/exercises/spiral-matrix/README.md +5 -5
- data/tracks/elixir/exercises/strain/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/elixir/exercises/strain/README.md +1 -3
- data/tracks/elixir/exercises/sublist/README.md +1 -4
- data/tracks/elixir/exercises/sum-of-multiples/README.md +4 -9
- data/tracks/elixir/exercises/tournament/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/elixir/exercises/tournament/README.md +6 -9
- data/tracks/elixir/exercises/transpose/README.md +6 -7
- data/tracks/elixir/exercises/triangle/README.md +10 -9
- data/tracks/elixir/exercises/twelve-days/README.md +2 -4
- data/tracks/elixir/exercises/word-count/README.md +2 -5
- data/tracks/elixir/exercises/wordy/README.md +1 -8
- data/tracks/elixir/exercises/zipper/README.md +2 -5
- data/tracks/fortran/README.md +1 -1
- data/tracks/fsharp/config/exercise_readme.go.tmpl +0 -3
- data/tracks/fsharp/exercises/accumulate/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/alphametics/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/beer-song/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/diamond/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/difference-of-squares/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/diffie-hellman/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/food-chain/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/gigasecond/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/grade-school/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/grains/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/house/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/lens-person/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/linked-list/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/nth-prime/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/palindrome-products/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/parallel-letter-frequency/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/poker/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/proverb/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/raindrops/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/rna-transcription/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/space-age/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/twelve-days/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fsharp/exercises/wordy/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/java/exercises/acronym/.meta/version +1 -1
- data/tracks/java/exercises/acronym/src/test/java/AcronymTest.java +6 -6
- data/tracks/java/exercises/raindrops/.meta/version +1 -0
- data/tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java +3 -1
- data/tracks/java/exercises/transpose/src/test/java/TransposeTest.java +5 -5
- data/tracks/java/exercises/word-count/.meta/src/reference/java/WordCount.java +1 -1
- data/tracks/java/exercises/word-count/.meta/version +1 -0
- data/tracks/java/exercises/word-count/src/test/java/WordCountTest.java +73 -3
- data/tracks/mips/config/exercise_readme.go.tmpl +0 -3
- data/tracks/perl5/config/exercise_readme.go.tmpl +0 -3
- data/tracks/php/exercises/bob/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/php/exercises/roman-numerals/roman-numerals_test.php +1 -1
- data/tracks/pony/config/exercise_readme.go.tmpl +0 -3
- data/tracks/python/config.json +14 -0
- data/tracks/python/exercises/isbn-verifier/README.md +43 -0
- data/tracks/python/exercises/isbn-verifier/example.py +8 -0
- data/tracks/python/exercises/isbn-verifier/isbn_verifier.py +2 -0
- data/tracks/python/exercises/isbn-verifier/isbn_verifier_test.py +54 -0
- data/tracks/rust/exercises/atbash-cipher/example.rs +0 -2
- data/tracks/rust/exercises/bracket-push/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/rust/exercises/crypto-square/example.rs +0 -2
- data/tracks/rust/exercises/etl/example.rs +0 -1
- data/tracks/rust/exercises/forth/example.rs +0 -1
- data/tracks/rust/exercises/largest-series-product/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/rust/exercises/pangram/example.rs +0 -1
- data/tracks/rust/exercises/parallel-letter-frequency/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/rust/exercises/scrabble-score/tests/scrabble-score.rs +9 -2
- data/tracks/rust/exercises/space-age/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/rust/exercises/triangle/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/bank-account/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/connect/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/gigasecond/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/hamming/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/hello-world/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/leap/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/nucleotide-count/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/parallel-letter-frequency/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/phone-number/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/robot-name/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/roman-numerals/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/scala/exercises/variable-length-quantity/{HINTS.md → .meta/hints.md} +0 -0
- metadata +87 -86
- data/tracks/elixir/docs/EXERCISE_README_INSERT.md +0 -35
- data/tracks/fsharp/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/mips/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/perl5/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/pony/docs/EXERCISE_README_INSERT.md +0 -0
data/tracks/fortran/README.md
CHANGED
@@ -62,7 +62,7 @@ Please keep the following in mind:
|
|
62
62
|
- Exercises should use only the Fortran core libraries.
|
63
63
|
|
64
64
|
- Please do not add a README or README.md file to the exercise directory. The READMEs are constructed using shared metadata, which lives in the
|
65
|
-
[exercism/x-common](https://github.com/exercism/x-common) repository. Further explanation can be found in [fixing-exercise-readmes](https://github.com/exercism/
|
65
|
+
[exercism/x-common](https://github.com/exercism/x-common) repository. Further explanation can be found in [fixing-exercise-readmes](https://github.com/exercism/docs/blob/master/language-tracks/exercises/anatomy/readmes.md)
|
66
66
|
|
67
67
|
- Each exercise should have a test suite, an example solution, a template file for the real implementation and ... (anything else that needs to go with each exercise for this track). The CI build expects files to be named using the following convention: (describe the Fortran convention for naming the various files that make up an exercise).
|
68
68
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -6,7 +6,7 @@ import static org.junit.Assert.assertEquals;
|
|
6
6
|
public class AcronymTest {
|
7
7
|
|
8
8
|
@Test
|
9
|
-
public void
|
9
|
+
public void basic() {
|
10
10
|
final String phrase = "Portable Network Graphics";
|
11
11
|
final String expected = "PNG";
|
12
12
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -14,7 +14,7 @@ public class AcronymTest {
|
|
14
14
|
|
15
15
|
@Ignore("Remove to run test")
|
16
16
|
@Test
|
17
|
-
public void
|
17
|
+
public void lowercaseWords() {
|
18
18
|
final String phrase = "Ruby on Rails";
|
19
19
|
final String expected = "ROR";
|
20
20
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -22,7 +22,7 @@ public class AcronymTest {
|
|
22
22
|
|
23
23
|
@Ignore("Remove to run test")
|
24
24
|
@Test
|
25
|
-
public void
|
25
|
+
public void punctuation() {
|
26
26
|
final String phrase = "First In, First Out";
|
27
27
|
final String expected = "FIFO";
|
28
28
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -30,7 +30,7 @@ public class AcronymTest {
|
|
30
30
|
|
31
31
|
@Ignore("Remove to run test")
|
32
32
|
@Test
|
33
|
-
public void
|
33
|
+
public void allCapsWords() {
|
34
34
|
final String phrase = "PHP: Hypertext Preprocessor";
|
35
35
|
final String expected = "PHP";
|
36
36
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -38,7 +38,7 @@ public class AcronymTest {
|
|
38
38
|
|
39
39
|
@Ignore("Remove to run test")
|
40
40
|
@Test
|
41
|
-
public void
|
41
|
+
public void NonAcronymAllCapsWord() {
|
42
42
|
final String phrase = "GNU Image Manipulation Program";
|
43
43
|
final String expected = "GIMP";
|
44
44
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -46,7 +46,7 @@ public class AcronymTest {
|
|
46
46
|
|
47
47
|
@Ignore("Remove to run test")
|
48
48
|
@Test
|
49
|
-
public void
|
49
|
+
public void hyphenated() {
|
50
50
|
final String phrase = "Complementary metal-oxide semiconductor";
|
51
51
|
final String expected = "CMOS";
|
52
52
|
assertEquals(expected, new Acronym(phrase).get());
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -20,18 +20,20 @@ public class RaindropConverterTest {
|
|
20
20
|
return Arrays.asList(new Object[][]{
|
21
21
|
// Non-primes
|
22
22
|
{1, "1"},
|
23
|
+
{8, "8"},
|
23
24
|
{52, "52"},
|
24
|
-
{12121, "12121"},
|
25
25
|
|
26
26
|
// Numbers with 3 as a prime factor
|
27
27
|
{3, "Pling"},
|
28
28
|
{6, "Pling"},
|
29
29
|
{9, "Pling"},
|
30
|
+
{27, "Pling"},
|
30
31
|
|
31
32
|
// Numbers with 5 as a prime factor
|
32
33
|
{5, "Plang"},
|
33
34
|
{10, "Plang"},
|
34
35
|
{25, "Plang"},
|
36
|
+
{3125, "Plang"},
|
35
37
|
|
36
38
|
// Numbers with 7 as a prime factor
|
37
39
|
{7, "Plong"},
|
@@ -23,7 +23,7 @@ public class TransposeTest {
|
|
23
23
|
|
24
24
|
@Ignore("Remove to run test")
|
25
25
|
@Test
|
26
|
-
public void
|
26
|
+
public void twoCharactersInARow() {
|
27
27
|
String input = "A1";
|
28
28
|
|
29
29
|
String expected = "A" +
|
@@ -34,7 +34,7 @@ public class TransposeTest {
|
|
34
34
|
|
35
35
|
@Ignore("Remove to run test")
|
36
36
|
@Test
|
37
|
-
public void
|
37
|
+
public void twoCharactersInAColumn() {
|
38
38
|
String input = "A\n" +
|
39
39
|
"1";
|
40
40
|
|
@@ -45,7 +45,7 @@ public class TransposeTest {
|
|
45
45
|
|
46
46
|
@Ignore("Remove to run test")
|
47
47
|
@Test
|
48
|
-
public void
|
48
|
+
public void simple() {
|
49
49
|
String input = "ABC\n" +
|
50
50
|
"123";
|
51
51
|
|
@@ -79,7 +79,7 @@ public class TransposeTest {
|
|
79
79
|
|
80
80
|
@Ignore("Remove to run test")
|
81
81
|
@Test
|
82
|
-
public void
|
82
|
+
public void firstLineLongerThanSecondLine() {
|
83
83
|
String input = "The fourth line.\n" +
|
84
84
|
"The fifth line.";
|
85
85
|
|
@@ -105,7 +105,7 @@ public class TransposeTest {
|
|
105
105
|
|
106
106
|
@Ignore("Remove to run test")
|
107
107
|
@Test
|
108
|
-
public void
|
108
|
+
public void secondLineLongerThanFirstLine() {
|
109
109
|
String input = "The first line.\n" +
|
110
110
|
"The second line.";
|
111
111
|
|
@@ -7,7 +7,7 @@ public class WordCount {
|
|
7
7
|
|
8
8
|
public Map<String, Integer> phrase( String input ) {
|
9
9
|
Map<String, Integer> countMap = new HashMap<>();
|
10
|
-
input = input.trim().toLowerCase().replaceAll("[\\
|
10
|
+
input = input.trim().toLowerCase().replaceAll("([^A-Za-z0-9']|\\B'|'\\B)", " ");
|
11
11
|
final String[] tokenizedInput = input.split("\\s+");
|
12
12
|
for( String aWord : tokenizedInput ) {
|
13
13
|
Integer count = countMap.get(aWord);
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
@@ -34,7 +34,7 @@ public class WordCountTest {
|
|
34
34
|
|
35
35
|
@Ignore("Remove to run test")
|
36
36
|
@Test
|
37
|
-
public void
|
37
|
+
public void countOneOfEachWord() {
|
38
38
|
expectedWordCount.put("one", 1);
|
39
39
|
expectedWordCount.put("of", 1);
|
40
40
|
expectedWordCount.put("each", 1);
|
@@ -47,7 +47,7 @@ public class WordCountTest {
|
|
47
47
|
|
48
48
|
@Ignore("Remove to run test")
|
49
49
|
@Test
|
50
|
-
public void
|
50
|
+
public void multipleOccurrencesOfAWord() {
|
51
51
|
expectedWordCount.put("one", 1);
|
52
52
|
expectedWordCount.put("fish", 4);
|
53
53
|
expectedWordCount.put("two", 1);
|
@@ -59,6 +59,32 @@ public class WordCountTest {
|
|
59
59
|
expectedWordCount, actualWordCount
|
60
60
|
);
|
61
61
|
}
|
62
|
+
|
63
|
+
@Ignore("Remove to run test")
|
64
|
+
@Test
|
65
|
+
public void handlesCrampedLists() {
|
66
|
+
expectedWordCount.put("one", 1);
|
67
|
+
expectedWordCount.put("two", 1);
|
68
|
+
expectedWordCount.put("three", 1);
|
69
|
+
|
70
|
+
actualWordCount = wordCount.phrase("one,two,three");
|
71
|
+
assertEquals(
|
72
|
+
expectedWordCount, actualWordCount
|
73
|
+
);
|
74
|
+
}
|
75
|
+
|
76
|
+
@Ignore("Remove to run test")
|
77
|
+
@Test
|
78
|
+
public void handlesExpandedLists() {
|
79
|
+
expectedWordCount.put("one", 1);
|
80
|
+
expectedWordCount.put("two", 1);
|
81
|
+
expectedWordCount.put("three", 1);
|
82
|
+
|
83
|
+
actualWordCount = wordCount.phrase("one,\ntwo,\nthree");
|
84
|
+
assertEquals(
|
85
|
+
expectedWordCount, actualWordCount
|
86
|
+
);
|
87
|
+
}
|
62
88
|
|
63
89
|
@Ignore("Remove to run test")
|
64
90
|
@Test
|
@@ -93,8 +119,52 @@ public class WordCountTest {
|
|
93
119
|
@Test
|
94
120
|
public void normalizeCase() {
|
95
121
|
expectedWordCount.put("go", 3);
|
122
|
+
expectedWordCount.put("stop", 2);
|
123
|
+
|
124
|
+
actualWordCount = wordCount.phrase("go Go GO Stop stop");
|
125
|
+
assertEquals(
|
126
|
+
expectedWordCount, actualWordCount
|
127
|
+
);
|
128
|
+
}
|
129
|
+
|
130
|
+
@Ignore("Remove to run test")
|
131
|
+
@Test
|
132
|
+
public void withApostrophes() {
|
133
|
+
expectedWordCount.put("first", 1);
|
134
|
+
expectedWordCount.put("don't", 2);
|
135
|
+
expectedWordCount.put("laugh", 1);
|
136
|
+
expectedWordCount.put("then", 1);
|
137
|
+
expectedWordCount.put("cry", 1);
|
138
|
+
|
139
|
+
actualWordCount = wordCount.phrase("First: don't laugh. Then: don't cry.");
|
140
|
+
assertEquals(
|
141
|
+
expectedWordCount, actualWordCount
|
142
|
+
);
|
143
|
+
}
|
144
|
+
|
145
|
+
@Ignore("Remove to run test")
|
146
|
+
@Test
|
147
|
+
public void withQuotations() {
|
148
|
+
expectedWordCount.put("joe", 1);
|
149
|
+
expectedWordCount.put("can't", 1);
|
150
|
+
expectedWordCount.put("tell", 1);
|
151
|
+
expectedWordCount.put("between", 1);
|
152
|
+
expectedWordCount.put("large", 2);
|
153
|
+
expectedWordCount.put("and", 1);
|
154
|
+
|
155
|
+
actualWordCount = wordCount.phrase("Joe can't tell between 'large' and large.");
|
156
|
+
assertEquals(
|
157
|
+
expectedWordCount, actualWordCount
|
158
|
+
);
|
159
|
+
}
|
160
|
+
|
161
|
+
@Ignore("Remove to run test")
|
162
|
+
@Test
|
163
|
+
public void multipleSpacesNotDetectedAsAWord() {
|
164
|
+
expectedWordCount.put("multiple", 1);
|
165
|
+
expectedWordCount.put("whitespaces", 1);
|
96
166
|
|
97
|
-
actualWordCount = wordCount.phrase("
|
167
|
+
actualWordCount = wordCount.phrase(" multiple whitespaces");
|
98
168
|
assertEquals(
|
99
169
|
expectedWordCount, actualWordCount
|
100
170
|
);
|
File without changes
|
@@ -111,7 +111,7 @@ class RomanTest extends PHPUnit\Framework\TestCase
|
|
111
111
|
$this->assertSame('MXXIV', toRoman(1024));
|
112
112
|
}
|
113
113
|
|
114
|
-
public function
|
114
|
+
public function test1998()
|
115
115
|
{
|
116
116
|
$this->markTestSkipped();
|
117
117
|
$this->assertSame('MCMXCVIII', toRoman(1998));
|
data/tracks/python/config.json
CHANGED
@@ -80,6 +80,20 @@
|
|
80
80
|
"transforming"
|
81
81
|
]
|
82
82
|
},
|
83
|
+
{
|
84
|
+
"uuid": "7961c852-c87a-44b0-b152-efea3ac8555c",
|
85
|
+
"slug": "isbn-verifier",
|
86
|
+
"core": false,
|
87
|
+
"unlocked_by": null,
|
88
|
+
"difficulty": 1,
|
89
|
+
"topics": [
|
90
|
+
"type_conversion",
|
91
|
+
"conditionals",
|
92
|
+
"strings",
|
93
|
+
"integers",
|
94
|
+
"parsing"
|
95
|
+
]
|
96
|
+
},
|
83
97
|
{
|
84
98
|
"uuid": "8648fa0c-d85f-471b-a3ae-0f8c05222c89",
|
85
99
|
"slug": "hamming",
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Isbn Verifier
|
2
|
+
|
3
|
+
Check if a given ISBN-10 is valid.
|
4
|
+
|
5
|
+
## Functionality
|
6
|
+
|
7
|
+
Given an unkown string the program should check if the provided string is a valid ISBN-10.
|
8
|
+
Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
|
9
|
+
|
10
|
+
The program should allow for ISBN-10 without the separating dashes to be verified as well.
|
11
|
+
|
12
|
+
## ISBN
|
13
|
+
|
14
|
+
Let's take a random ISBN-10 number, say `3-598-21508-8` for this.
|
15
|
+
The first digit block indicates the group where the ISBN belongs. Groups can consist of shared languages, geographic regions or countries. The leading '3' signals this ISBN is from a german speaking country.
|
16
|
+
The following number block is to identify the publisher. Since this is a three digit publisher number there is a 5 digit title number for this book.
|
17
|
+
The last digit in the ISBN is the check digit which is used to detect read errors.
|
18
|
+
|
19
|
+
The first 9 digits in the ISBN have to be between 0 and 9.
|
20
|
+
The check digit can additionally be an 'X' to allow 10 to be a valid check digit as well.
|
21
|
+
|
22
|
+
A valid ISBN-10 is calculated with this formula `(x1 * 10 + x2 * 9 + x3 * 8 + x4 * 7 + x5 * 6 + x6 * 5 + x7 * 4 + x8 * 3 + x9 * 2 + x10 * 1) mod 11 == 0`
|
23
|
+
So for our example ISBN this means:
|
24
|
+
(3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 = 0
|
25
|
+
|
26
|
+
Which proves that the ISBN is valid.
|
27
|
+
|
28
|
+
### Submitting Exercises
|
29
|
+
|
30
|
+
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
31
|
+
|
32
|
+
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
|
33
|
+
|
34
|
+
|
35
|
+
For more detailed information about running tests, code style and linting,
|
36
|
+
please see the [help page](http://exercism.io/languages/python).
|
37
|
+
|
38
|
+
## Source
|
39
|
+
|
40
|
+
Converting a string into a number and some basic processing utilizing a relatable real world example. [https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation](https://en.wikipedia.org/wiki/International_Standard_Book_Number)
|
41
|
+
|
42
|
+
## Submitting Incomplete Solutions
|
43
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
def verify(isbn):
|
2
|
+
chars = list(isbn.replace('-', ''))
|
3
|
+
if chars and chars[-1] == 'X':
|
4
|
+
chars[-1] = '10'
|
5
|
+
if not len(chars) == 10 or not all(c.isdigit() for c in chars):
|
6
|
+
return False
|
7
|
+
indices = list(range(10, 0, -1))
|
8
|
+
return sum(int(c) * i for c, i in zip(chars, indices)) % 11 == 0
|