trackler 2.2.1.87 → 2.2.1.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/bash/.travis.yml +6 -2
  4. data/tracks/bash/bin/validate-exercises +37 -0
  5. data/tracks/bash/exercises/reverse-string/example.sh +1 -1
  6. data/tracks/bash/exercises/reverse-string/reverse_string_test.sh +7 -7
  7. data/tracks/csharp/exercises/bracket-push/BracketPush.cs +2 -15
  8. data/tracks/elisp/.travis.yml +2 -2
  9. data/tracks/elisp/config.json +8 -0
  10. data/tracks/elisp/exercises/pangram/README.md +16 -0
  11. data/tracks/elisp/exercises/pangram/example.el +17 -0
  12. data/tracks/elisp/exercises/pangram/pangram-test.el +41 -0
  13. data/tracks/elisp/exercises/pangram/pangram.el +9 -0
  14. data/tracks/gnu-apl/config.json +6 -6
  15. data/tracks/java/exercises/phone-number/.meta/hints.md +58 -0
  16. data/tracks/java/exercises/phone-number/README.md +62 -0
  17. data/tracks/java/exercises/rna-transcription/.meta/version +1 -1
  18. data/tracks/java/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java +0 -29
  19. data/tracks/python/.travis.yml +2 -2
  20. data/tracks/python/exercises/complex-numbers/.meta/hints.md +3 -0
  21. data/tracks/python/exercises/complex-numbers/README.md +4 -0
  22. data/tracks/python/exercises/complex-numbers/complex_numbers.py +5 -5
  23. data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +28 -32
  24. data/tracks/python/exercises/complex-numbers/example.py +8 -5
  25. data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +3 -3
  26. data/tracks/python/exercises/difference-of-squares/example.py +6 -6
  27. data/tracks/python/exercises/palindrome-products/example.py +112 -11
  28. data/tracks/python/exercises/palindrome-products/palindrome_products_test.py +55 -14
  29. data/tracks/python/exercises/pangram/pangram_test.py +9 -6
  30. data/tracks/python/exercises/phone-number/phone_number_test.py +2 -2
  31. data/tracks/python/exercises/secret-handshake/example.py +14 -47
  32. data/tracks/python/exercises/secret-handshake/secret_handshake.py +2 -2
  33. data/tracks/python/exercises/secret-handshake/secret_handshake_test.py +56 -25
  34. data/tracks/python/exercises/transpose/example.py +5 -5
  35. data/tracks/python/exercises/transpose/transpose_test.py +37 -74
  36. data/tracks/python/exercises/word-search/example.py +1 -1
  37. data/tracks/python/exercises/word-search/word_search_test.py +63 -63
  38. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9831edbe740fe63ce68b6941ca2287b894679f2
4
- data.tar.gz: f83171332fb232afefcf15ad51664fbf96e22dfd
3
+ metadata.gz: 5957f729112f4f43919c3c765109db6e6d2a239d
4
+ data.tar.gz: ec02fec7fdfa555fd8fceb7fea89c24e90b0bd18
5
5
  SHA512:
6
- metadata.gz: 7ffc257c14ace22234f3c4701c993a3c78a46f298e3a9044fd0e2535f0a667ac1e20251e9433e5470bd6c2ce0d808ecbb4baf51806e94e6e1d99e8f0d738c7e7
7
- data.tar.gz: 44e076dcdb1bba7f3b13e5627942efac6225ced9ed4d7b4d204900ec0fb2f2ee646926727d96a5fcc78fd131a20fad7e81bbb5a86c0de8f6ff0d4d705e34f333
6
+ metadata.gz: 7732abc8fa6638740667703e3cd7a78abc398675de413e83f1a454199d37c4c93eff038bc82adebc49f1d14eabad362380f6125237090c3ab636827faa2692bd
7
+ data.tar.gz: d19cfde995d99e9f5045bed54a8f6be52975f69be9e7e12d7b4fdd71efded89470f9e30631c4cf196416d8a394a0454a3da44049f16c79e1c008c472ae30248c
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.87"
2
+ VERSION = "2.2.1.88"
3
3
  end
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  language: bash
3
3
  sudo: false
4
+
5
+ before_script:
6
+ - bin/fetch-configlet
7
+
4
8
  script:
5
- - bin/fetch-configlet
6
- - bin/configlet lint .
9
+ - bin/configlet lint .
10
+ - bin/validate-exercises
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Validate if tests can run properly and the example implementation
4
+ # is passing the tests for each exercise
5
+
6
+ set -o errexit
7
+ set -o nounset
8
+
9
+ root_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
10
+ temp_folder_name="exercises_temp/"
11
+ temp_folder="$root_path/$temp_folder_name"
12
+
13
+ # Clean up after script on normal or forced exit
14
+ trap "{ rm -rf $temp_folder; }" EXIT
15
+
16
+ cp exercises $temp_folder -r
17
+ cd $temp_folder
18
+
19
+ for exercise in *; do
20
+ cd $exercise
21
+ echo "Processing $exercise"
22
+
23
+ # Replace "-" with "_" to follow bash conventions
24
+ exercise_name=$(echo "$exercise" | sed -r 's/[-]+/_/g')
25
+ test_file=${exercise_name}_test.sh
26
+
27
+ # Create implementation file from example
28
+ cp example.sh ${exercise_name}.sh
29
+
30
+ # Unskip all the tests
31
+ sed -i 's/skip/# skip/g' $test_file
32
+
33
+ # Run the tests
34
+ bats $test_file
35
+
36
+ cd ../
37
+ done
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- echo $1|rev
3
+ echo $1 | rev
@@ -2,7 +2,7 @@
2
2
 
3
3
  @test "An empty string" {
4
4
  #skip
5
- run bash reverse_string.sh
5
+ run bash reverse_string.sh ""
6
6
 
7
7
  [ "$status" -eq 0 ]
8
8
  [ "$output" = "" ]
@@ -10,21 +10,21 @@
10
10
 
11
11
  @test "A word" {
12
12
  skip
13
- run bash reverse_string.sh robot
13
+ run bash reverse_string.sh "robot"
14
14
 
15
15
  [ "$status" -eq 0 ]
16
16
  [ "$output" = "tobor" ]
17
17
  }
18
18
 
19
- @test "A capitalised word" {
19
+ @test "A capitalised word" {
20
20
  skip
21
- run bash reverse_string.sh Ramen
21
+ run bash reverse_string.sh "Ramen"
22
22
 
23
23
  [ "$status" -eq 0 ]
24
24
  [ "$output" = "nemaR" ]
25
25
  }
26
26
 
27
- @test "A sentence with punctuation" {
27
+ @test "A sentence with punctuation" {
28
28
  skip
29
29
  run bash reverse_string.sh "I'm hungry!"
30
30
 
@@ -32,9 +32,9 @@
32
32
  [ "$output" = "!yrgnuh m'I" ]
33
33
  }
34
34
 
35
- @test "A palindrome" {
35
+ @test "A palindrome" {
36
36
  skip
37
- run bash reverse_string.sh racecar
37
+ run bash reverse_string.sh "racecar"
38
38
 
39
39
  [ "$status" -eq 0 ]
40
40
  [ "$output" = "racecar" ]
@@ -1,22 +1,9 @@
1
- using System.Linq;
1
+ using System;
2
2
 
3
3
  public static class BracketPush
4
4
  {
5
5
  public static bool IsPaired(string input)
6
6
  {
7
- var brackets = new string(input.Where(c => "[]{}()".Contains(c)).ToArray());
8
- var previousLength = brackets.Length;
9
-
10
- while (brackets.Length > 0)
11
- {
12
- brackets = brackets.Replace("[]", "").Replace("{}", "").Replace("()", "");
13
-
14
- if (brackets.Length == previousLength)
15
- return false;
16
-
17
- previousLength = brackets.Length;
18
- }
19
-
20
- return true;
7
+ throw new NotImplementedException();
21
8
  }
22
9
  }
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  language: bash
3
3
  before_install:
4
- - sudo add-apt-repository -y ppa:cassou/emacs # Emacs 24.3
4
+ - sudo add-apt-repository -y ppa:kelleyk/emacs # Emacs 25
5
5
  - sudo apt-get update
6
- - sudo apt-get install -y emacs24-nox
6
+ - sudo apt-get install -y emacs25
7
7
  script:
8
8
  - bin/fetch-configlet
9
9
  - bin/configlet lint .
@@ -41,6 +41,14 @@
41
41
  "unlocked_by": null,
42
42
  "uuid": "2bfb508e-7ceb-4ae1-8316-1e2daf771807"
43
43
  },
44
+ {
45
+ "core": false,
46
+ "difficulty": 1,
47
+ "slug": "pangram",
48
+ "topics": null,
49
+ "unlocked_by": null,
50
+ "uuid": "28aea3bc-0ca0-4af9-868a-02e71c3d996"
51
+ },
44
52
  {
45
53
  "core": false,
46
54
  "difficulty": 1,
@@ -0,0 +1,16 @@
1
+ # Pangram
2
+
3
+ Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma,
4
+ "every letter") is a sentence using every letter of the alphabet at least once.
5
+ The best known English pangram is:
6
+ > The quick brown fox jumps over the lazy dog.
7
+
8
+ The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case
9
+ insensitive. Input will not contain non-ASCII symbols.
10
+
11
+ ## Source
12
+
13
+ Wikipedia [https://en.wikipedia.org/wiki/Pangram](https://en.wikipedia.org/wiki/Pangram)
14
+
15
+ ## Submitting Incomplete Solutions
16
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,17 @@
1
+ ;;; pangram.el --- Pangram (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+ (require 'cl-lib)
7
+
8
+ (defun is-pangram (phrase)
9
+ "Determine if a given phrase is a pangram."
10
+ (let ((alphabet "abcdefghijklmnopqrstuvwxyz"))
11
+ (cl-every
12
+ (lambda (c) (string-match-p (char-to-string c) phrase))
13
+ alphabet)))
14
+
15
+
16
+ (provide 'pangram)
17
+ ;;; pangram.el ends here
@@ -0,0 +1,41 @@
1
+ ;;; pagram-test.el --- Tests for Pangram (exercism)
2
+
3
+ ;;; Commentary:
4
+ ;; Common test data version: 1.3.0 d79e13e
5
+
6
+ ;;; Code:
7
+
8
+ (load-file "pangram.el")
9
+
10
+ (ert-deftest sentence-empty ()
11
+ (should (equal nil (is-pangram ""))))
12
+
13
+ (ert-deftest recognizes-a-perfect-lower-case-pangram ()
14
+ (should (equal t (is-pangram "abcdefghijklmnopqrstuvwxyz"))))
15
+
16
+ (ert-deftest pangram-with-only-lower-case ()
17
+ (should (equal t (is-pangram "the quick brown fox jumps over the lazy dog"))))
18
+
19
+ (ert-deftest missing-character-x ()
20
+ (should (equal nil (is-pangram "a quick movement of the enemy will jeopardize five gunboats"))))
21
+
22
+ (ert-deftest missing-another-character-eg-h ()
23
+ (should (equal nil (is-pangram "five boxing wizards jump quickly at it"))))
24
+
25
+ (ert-deftest pangram-with-underscores ()
26
+ (should (equal t (is-pangram "the_quick_brown_fox_jumps_over_the_lazy_dog"))))
27
+
28
+ (ert-deftest pangram-with-numbers ()
29
+ (should (equal t (is-pangram "the 1 quick brown fox jumps over the 2 lazy dogs"))))
30
+
31
+ (ert-deftest missing-letters-replaced-by-numbers ()
32
+ (should (equal nil (is-pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"))))
33
+
34
+ (ert-deftest pangram-with-mixed-case-and-punctuation ()
35
+ (should (equal t (is-pangram "\"Five quacking Zephyrs jolt my wax bed.\""))))
36
+
37
+ (ert-deftest upper-and-lower-case-versions-of-the-same-character-should-not-be-counted-separately ()
38
+ (should (equal nil (is-pangram "the quick brown fox jumps over with lazy FX"))))
39
+
40
+ (provide 'pangram-test)
41
+ ;;; pagram-test.el ends here
@@ -0,0 +1,9 @@
1
+ ;;; pangram.el --- Pangram (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+
8
+ (provide 'pangram)
9
+ ;;; pangram.el ends here
@@ -12,42 +12,42 @@
12
12
  "topics": ["setup"]
13
13
  },
14
14
  {
15
- "uuid": "9a89822e-0d61-f980-49fa-c273c0a0e0869b9fc7f",
15
+ "uuid": "edf36b1a-3f20-4d63-a919-55a2bd063a2f",
16
16
  "slug": "leap",
17
17
  "core": true,
18
18
  "difficulty": 1,
19
19
  "topics": ["conditions", "dates"]
20
20
  },
21
21
  {
22
- "uuid": "bc2c01ff-0e38-b280-5047-2014e184502c67074c0",
22
+ "uuid": "4ddbc20a-46dc-4e00-b472-0e108bab3481",
23
23
  "slug": "hamming",
24
24
  "core": true,
25
25
  "difficulty": 1,
26
26
  "topics": ["strings", "arrays", "differences"]
27
27
  },
28
28
  {
29
- "uuid": "05764380-02d5-2a80-0741-3baa1e10b36b61333ec",
29
+ "uuid": "4fbbeab4-2e54-4549-b78b-4c9ec1fea9c0",
30
30
  "slug": "rna-transcription",
31
31
  "core": true,
32
32
  "difficulty": 1,
33
33
  "topics": ["strings", "arrays", "substitution", "error handling"]
34
34
  },
35
35
  {
36
- "uuid": "17c7a5fc-0666-8780-a4f6-fe32a590bb970725b2e",
36
+ "uuid": "c5f5231d-dce9-4684-9d66-c8a462fecae9",
37
37
  "slug": "raindrops",
38
38
  "core": true,
39
39
  "difficulty": 1,
40
40
  "topics": ["strings", "residue", "conditions"]
41
41
  },
42
42
  {
43
- "uuid": "b9d47ae7-0df7-2a80-cbe1-a40548a641756b77e3f",
43
+ "uuid": "0a5c1f23-8f3f-479c-8ed5-ce21361daa20",
44
44
  "slug": "difference-of-squares",
45
45
  "core": true,
46
46
  "difficulty": 1,
47
47
  "topics": ["reduce", "arrays"]
48
48
  },
49
49
  {
50
- "uuid": "a6da3d26-0b3f-cb80-478f-0da928bdbf2975c8605",
50
+ "uuid": "7d52c43e-d193-4c90-a91b-0e6ee605cccb",
51
51
  "slug": "pangram",
52
52
  "core": true,
53
53
  "difficulty": 1,
@@ -0,0 +1,58 @@
1
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
2
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
3
+ It does mean that when you first try to run the tests, they won't compile.
4
+ They will give you an error similar to:
5
+ ```
6
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
7
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
8
+ ^
9
+ symbol: class ExerciseClassName
10
+ location: class ExerciseClassNameTest
11
+ ```
12
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
13
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
14
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
15
+
16
+ When you try to run the tests again you will get slightly different errors.
17
+ You might get an error similar to:
18
+ ```
19
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
20
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
21
+ ^
22
+ required: no arguments
23
+ found: String
24
+ reason: actual and formal argument lists differ in length
25
+ ```
26
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
27
+ If you don't add a constructor, Java will add a default one for you.
28
+ This default constructor takes no arguments.
29
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
30
+ In the example above you could add:
31
+ ```
32
+ ExerciseClassName(String input) {
33
+
34
+ }
35
+ ```
36
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
37
+
38
+ You might also get an error similar to:
39
+ ```
40
+ error: cannot find symbol
41
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
42
+ ^
43
+ symbol: method someMethod()
44
+ location: variable exerciseClassName of type ExerciseClassName
45
+ ```
46
+ This error means that you need to add a method called `someMethod` to your new class.
47
+ In the example above you would add:
48
+ ```
49
+ String someMethod() {
50
+ return "";
51
+ }
52
+ ```
53
+ Make sure the return type matches what the test is expecting.
54
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
55
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
56
+ The new error should tell you which type it's expecting.
57
+
58
+ After having resolved these errors you should be ready to start making the tests pass!
@@ -28,6 +28,68 @@ should all produce the output
28
28
 
29
29
  **Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code.
30
30
 
31
+ # Java Tips
32
+
33
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
34
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
35
+ It does mean that when you first try to run the tests, they won't compile.
36
+ They will give you an error similar to:
37
+ ```
38
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
39
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
40
+ ^
41
+ symbol: class ExerciseClassName
42
+ location: class ExerciseClassNameTest
43
+ ```
44
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
45
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
46
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
47
+
48
+ When you try to run the tests again you will get slightly different errors.
49
+ You might get an error similar to:
50
+ ```
51
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
52
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
53
+ ^
54
+ required: no arguments
55
+ found: String
56
+ reason: actual and formal argument lists differ in length
57
+ ```
58
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
59
+ If you don't add a constructor, Java will add a default one for you.
60
+ This default constructor takes no arguments.
61
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
62
+ In the example above you could add:
63
+ ```
64
+ ExerciseClassName(String input) {
65
+
66
+ }
67
+ ```
68
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
69
+
70
+ You might also get an error similar to:
71
+ ```
72
+ error: cannot find symbol
73
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
74
+ ^
75
+ symbol: method someMethod()
76
+ location: variable exerciseClassName of type ExerciseClassName
77
+ ```
78
+ This error means that you need to add a method called `someMethod` to your new class.
79
+ In the example above you would add:
80
+ ```
81
+ String someMethod() {
82
+ return "";
83
+ }
84
+ ```
85
+ Make sure the return type matches what the test is expecting.
86
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
87
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
88
+ The new error should tell you which type it's expecting.
89
+
90
+ After having resolved these errors you should be ready to start making the tests pass!
91
+
92
+
31
93
  # Running the tests
32
94
 
33
95
  You can run all the tests for an exercise by entering
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0