trackler 2.0.8.51 → 2.0.8.52

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/cpp/.editorconfig +21 -0
  4. data/tracks/cpp/exercises/anagram/anagram_test.cpp +2 -1
  5. data/tracks/cpp/exercises/nucleotide-count/example.cpp +5 -1
  6. data/tracks/cpp/exercises/nucleotide-count/nucleotide_count_test.cpp +5 -0
  7. data/tracks/cpp/exercises/queen-attack/queen_attack_test.cpp +8 -5
  8. data/tracks/elixir/config.json +8 -0
  9. data/tracks/elixir/exercises/hello-world/hello_world.exs +1 -1
  10. data/tracks/elixir/exercises/scale-generator/example.exs +119 -0
  11. data/tracks/elixir/exercises/scale-generator/scale_generator.exs +83 -0
  12. data/tracks/elixir/exercises/scale-generator/scale_generator_test.exs +282 -0
  13. data/tracks/go/README.md +17 -4
  14. data/tracks/go/gen/gen.go +85 -15
  15. data/tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangleGenerator.java +21 -0
  16. data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java +86 -0
  17. data/tracks/javascript/.github/stale.yml +0 -0
  18. data/tracks/javascript/exercises/leap/HINT.md +52 -0
  19. data/tracks/javascript/exercises/leap/leap.js +6 -2
  20. data/tracks/objective-c/docs/TESTS.md +5 -4
  21. data/tracks/purescript/config.json +8 -0
  22. data/tracks/purescript/exercises/crypto-square/bower.json +18 -0
  23. data/tracks/purescript/exercises/crypto-square/examples/src/CryptoSquare.purs +63 -0
  24. data/tracks/purescript/exercises/crypto-square/src/CryptoSquare.purs +6 -0
  25. data/tracks/purescript/exercises/crypto-square/test/Main.purs +92 -0
  26. data/tracks/ruby/exercises/hello-world/.meta/.version +1 -1
  27. data/tracks/ruby/exercises/hello-world/example.tt +7 -5
  28. data/tracks/ruby/exercises/hello-world/hello_world_test.rb +4 -15
  29. data/tracks/ruby/lib/hello_world_cases.rb +5 -5
  30. metadata +14 -6
  31. data/tracks/clojurescript/.github/ISSUE_TEMPLATE.md +0 -9
  32. data/tracks/cpp/exercises/queen-attack/require_equal_containers.h +0 -88
  33. data/tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangle.java +0 -26
  34. data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java +0 -85
@@ -0,0 +1,6 @@
1
+ module CryptoSquare
2
+ ( normalizedPlaintext
3
+ , plaintextSegments
4
+ , encoded
5
+ , ciphertext
6
+ ) where
@@ -0,0 +1,92 @@
1
+ module Test.Main where
2
+
3
+ import Prelude
4
+ import Control.Monad.Eff (Eff)
5
+ import Test.Unit.Assert as Assert
6
+ import Test.Unit (suite, test)
7
+ import Test.Unit.Main (runTest)
8
+ import CryptoSquare ( normalizedPlaintext
9
+ , plaintextSegments
10
+ , encoded
11
+ , ciphertext
12
+ )
13
+
14
+ main :: Eff _ Unit
15
+ main = runTest do
16
+
17
+ suite "CryptoSquare.normalizedPlaintext" do
18
+
19
+ test "Lowercase" $
20
+ Assert.equal "hello"
21
+ (normalizedPlaintext "Hello")
22
+
23
+ test "Remove spaces" $
24
+ Assert.equal "hithere"
25
+ (normalizedPlaintext "Hi there")
26
+
27
+ test "Remove punctuation" $
28
+ Assert.equal "123go"
29
+ (normalizedPlaintext "@1, 2%, 3 Go!")
30
+
31
+ suite "CryptoSquare.plaintextSegments" do
32
+
33
+ test "empty plaintext results in an empty rectangle" $
34
+ Assert.equal
35
+ []
36
+ (plaintextSegments "")
37
+
38
+ test "4 character plaintext results in an 2x2 rectangle" $
39
+ Assert.equal
40
+ [ "ab"
41
+ , "cd"
42
+ ]
43
+ (plaintextSegments "Ab Cd")
44
+
45
+ test "9 character plaintext results in an 3x3 rectangle" $
46
+ Assert.equal
47
+ [ "thi"
48
+ , "sis"
49
+ , "fun"
50
+ ]
51
+ (plaintextSegments "This is fun!")
52
+
53
+ test "54 character plaintext results in an 8x7 rectangle" $
54
+ Assert.equal
55
+ [ "ifmanwas"
56
+ , "meanttos"
57
+ , "tayonthe"
58
+ , "groundgo"
59
+ , "dwouldha"
60
+ , "vegivenu"
61
+ , "sroots"
62
+ ]
63
+ (plaintextSegments "If man was meant to stay on the ground, god would have given us roots.")
64
+
65
+ suite "CryptoSquare.encoded" do
66
+
67
+ test "empty plaintext results in an empty encode" $
68
+ Assert.equal
69
+ ""
70
+ (encoded "")
71
+
72
+ test "Non-empty plaintext results in the combined plaintext segments" $
73
+ Assert.equal
74
+ "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
75
+ (encoded "If man was meant to stay on the ground, god would have given us roots.")
76
+
77
+ suite "CryptoSquare.ciphertext" do
78
+
79
+ test "empty plaintext results in an empty ciphertext" $
80
+ Assert.equal
81
+ ""
82
+ (ciphertext "")
83
+
84
+ test "9 character plaintext results in 3 chunks of 3 characters" $
85
+ Assert.equal
86
+ "tsf hiu isn"
87
+ (ciphertext "This is fun!")
88
+
89
+ test "54 character plaintext results in 7 chunks, the last two padded with spaces" $
90
+ Assert.equal
91
+ "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
92
+ (ciphertext "If man was meant to stay on the ground, god would have given us roots.")
@@ -13,12 +13,14 @@ rescue LoadError => e
13
13
  end
14
14
 
15
15
  # Common test data version: <%= abbreviated_commit_hash %>
16
- class HelloWorldTest < Minitest::Test<% test_cases.each do |test_case| %>
17
- def <%= test_case.test_name %><% if test_case.skipped? %>
18
- skip<% end %>
19
- assert_equal '<%= test_case.expected %>', <%= test_case.do %>
16
+ class HelloWorldTest < Minitest::Test
17
+ <% test_cases.each do |test_case| %>
18
+ def <%= test_case.test_name %>
19
+ <%= test_case.skipped %>
20
+ <%= test_case.workload %>
20
21
  end
21
- <% end %>end
22
+ <% end %>
23
+ end
22
24
 
23
25
  __END__
24
26
 
@@ -12,22 +12,11 @@ rescue LoadError => e
12
12
  exit 1
13
13
  end
14
14
 
15
- # Test data version:
16
- # deb225e Implement canonical dataset for scrabble-score problem (#255)
17
-
15
+ # Common test data version: 4b9ae53
18
16
  class HelloWorldTest < Minitest::Test
19
- def test_no_name
20
- assert_equal 'Hello, World!', HelloWorld.hello
21
- end
22
-
23
- def test_sample_name
24
- skip
25
- assert_equal 'Hello, Alice!', HelloWorld.hello('Alice')
26
- end
27
-
28
- def test_other_sample_name
29
- skip
30
- assert_equal 'Hello, Bob!', HelloWorld.hello('Bob')
17
+ def test_hello
18
+ # skip
19
+ assert_equal "Hello, World!", HelloWorld.hello
31
20
  end
32
21
  end
33
22
 
@@ -2,15 +2,15 @@ require 'exercise_cases'
2
2
 
3
3
  class HelloWorldCase < OpenStruct
4
4
  def test_name
5
- 'test_%s' % description.gsub(/[ -]/, '_')
5
+ 'test_%s' % property.gsub(/[ -]/, '_')
6
6
  end
7
7
 
8
- def do
9
- defined?(name) ? "HelloWorld.hello('#{name}')" : 'HelloWorld.hello'
8
+ def workload
9
+ "assert_equal #{expected.inspect}, HelloWorld.hello"
10
10
  end
11
11
 
12
- def skipped?
13
- index > 0
12
+ def skipped
13
+ index.zero? ? '# skip' : 'skip'
14
14
  end
15
15
  end
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8.51
4
+ version: 2.0.8.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-15 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -1063,7 +1063,6 @@ files:
1063
1063
  - tracks/clojure/img/icon.png
1064
1064
  - tracks/clojure/project.clj
1065
1065
  - tracks/clojurescript/.git
1066
- - tracks/clojurescript/.github/ISSUE_TEMPLATE.md
1067
1066
  - tracks/clojurescript/.gitignore
1068
1067
  - tracks/clojurescript/.travis.yml
1069
1068
  - tracks/clojurescript/LICENSE
@@ -1148,6 +1147,7 @@ files:
1148
1147
  - tracks/coldfusion/exercises/leap/leap.cfc
1149
1148
  - tracks/coldfusion/exercises/leap/leap_tests.cfc
1150
1149
  - tracks/coldfusion/img/icon.png
1150
+ - tracks/cpp/.editorconfig
1151
1151
  - tracks/cpp/.git
1152
1152
  - tracks/cpp/.gitignore
1153
1153
  - tracks/cpp/.travis.yml
@@ -1251,7 +1251,6 @@ files:
1251
1251
  - tracks/cpp/exercises/queen-attack/example.cpp
1252
1252
  - tracks/cpp/exercises/queen-attack/example.h
1253
1253
  - tracks/cpp/exercises/queen-attack/queen_attack_test.cpp
1254
- - tracks/cpp/exercises/queen-attack/require_equal_containers.h
1255
1254
  - tracks/cpp/exercises/raindrops/CMakeLists.txt
1256
1255
  - tracks/cpp/exercises/raindrops/example.cpp
1257
1256
  - tracks/cpp/exercises/raindrops/example.h
@@ -2643,6 +2642,9 @@ files:
2643
2642
  - tracks/elixir/exercises/say/example.exs
2644
2643
  - tracks/elixir/exercises/say/say.exs
2645
2644
  - tracks/elixir/exercises/say/say_test.exs
2645
+ - tracks/elixir/exercises/scale-generator/example.exs
2646
+ - tracks/elixir/exercises/scale-generator/scale_generator.exs
2647
+ - tracks/elixir/exercises/scale-generator/scale_generator_test.exs
2646
2648
  - tracks/elixir/exercises/scrabble-score/example.exs
2647
2649
  - tracks/elixir/exercises/scrabble-score/scrabble.exs
2648
2650
  - tracks/elixir/exercises/scrabble-score/scrabble_score_test.exs
@@ -4473,9 +4475,9 @@ files:
4473
4475
  - tracks/java/exercises/pangram/src/main/java/PangramChecker.java
4474
4476
  - tracks/java/exercises/pangram/src/test/java/PangramCheckerTest.java
4475
4477
  - tracks/java/exercises/pascals-triangle/build.gradle
4476
- - tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangle.java
4478
+ - tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangleGenerator.java
4477
4479
  - tracks/java/exercises/pascals-triangle/src/main/java/.keep
4478
- - tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
4480
+ - tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java
4479
4481
  - tracks/java/exercises/perfect-numbers/build.gradle
4480
4482
  - tracks/java/exercises/perfect-numbers/src/example/java/Classification.java
4481
4483
  - tracks/java/exercises/perfect-numbers/src/example/java/NaturalNumber.java
@@ -4609,6 +4611,7 @@ files:
4609
4611
  - tracks/java/scripts/prune-extra-keep-files.sh
4610
4612
  - tracks/javascript/.editorconfig
4611
4613
  - tracks/javascript/.git
4614
+ - tracks/javascript/.github/stale.yml
4612
4615
  - tracks/javascript/.gitignore
4613
4616
  - tracks/javascript/.travis.yml
4614
4617
  - tracks/javascript/LICENSE
@@ -4693,6 +4696,7 @@ files:
4693
4696
  - tracks/javascript/exercises/kindergarten-garden/kindergarten-garden.spec.js
4694
4697
  - tracks/javascript/exercises/largest-series-product/example.js
4695
4698
  - tracks/javascript/exercises/largest-series-product/largest-series-product.spec.js
4699
+ - tracks/javascript/exercises/leap/HINT.md
4696
4700
  - tracks/javascript/exercises/leap/example.js
4697
4701
  - tracks/javascript/exercises/leap/leap.js
4698
4702
  - tracks/javascript/exercises/leap/leap.spec.js
@@ -6627,6 +6631,10 @@ files:
6627
6631
  - tracks/purescript/exercises/bracket-push/examples/src/BracketPush.purs
6628
6632
  - tracks/purescript/exercises/bracket-push/src/BracketPush.purs
6629
6633
  - tracks/purescript/exercises/bracket-push/test/Main.purs
6634
+ - tracks/purescript/exercises/crypto-square/bower.json
6635
+ - tracks/purescript/exercises/crypto-square/examples/src/CryptoSquare.purs
6636
+ - tracks/purescript/exercises/crypto-square/src/CryptoSquare.purs
6637
+ - tracks/purescript/exercises/crypto-square/test/Main.purs
6630
6638
  - tracks/purescript/exercises/diamond/bower.json
6631
6639
  - tracks/purescript/exercises/diamond/examples/src/Diamond.purs
6632
6640
  - tracks/purescript/exercises/diamond/src/Diamond.purs
@@ -1,9 +0,0 @@
1
- **What programming language should we add?**
2
-
3
- **What is the official website for the language?**
4
-
5
- **Is this a language that comes in many variants? If so, which variant should we support?**
6
-
7
- **Is there a testing framework available for the language?**
8
-
9
- **Who will be leading the effort to launch the track?**
@@ -1,88 +0,0 @@
1
- #if !defined(REQUIRE_EQUAL_CONTAINERS_H)
2
- #define REQUIRE_EQUAL_CONTAINERS_H
3
-
4
- #include <utility>
5
- #include <vector>
6
- #include <boost/version.hpp>
7
-
8
- #if BOOST_VERSION >= 105900
9
-
10
- namespace boost
11
- {
12
- namespace test_tools
13
- {
14
- namespace tt_detail
15
- {
16
-
17
- // teach Boost.Test how to print std::vector<T>
18
- template <typename T>
19
- inline std::ostream &operator<<(std::ostream &str, std::vector<T> const &items)
20
- {
21
- str << '[';
22
- bool first = true;
23
- for (auto const& element : items) {
24
- str << (!first ? "," : "") << element;
25
- first = false;
26
- }
27
- return str << ']';
28
- }
29
-
30
- // teach Boost.Test how to print std::pair<K,V>
31
- template <typename K, typename V>
32
- inline std::ostream &operator<<(std::ostream &str, std::pair<K, V> const& item)
33
- {
34
- return str << '<' << item.first << ',' << item.second << '>';
35
- }
36
-
37
- } // namespace tt_detail
38
- } // namespace test_tools
39
- } // namespace boost
40
-
41
- #else // BOOST_VERSION < 105900
42
-
43
- namespace boost
44
- {
45
-
46
- // teach Boost.Test how to print std::vector to wrap_stringstream
47
- template <typename T>
48
- inline wrap_stringstream&
49
- operator<<(wrap_stringstream& wrapped, std::vector<T> const& item)
50
- {
51
- wrapped << '[';
52
- bool first = true;
53
- for (auto const& element : item) {
54
- wrapped << (!first ? "," : "") << element;
55
- first = false;
56
- }
57
- return wrapped << ']';
58
- }
59
-
60
- // teach Boost.Test how to print std::pair<K,V> to wrap_stringstream
61
- template <typename K, typename V>
62
- inline wrap_stringstream &operator<<(wrap_stringstream &str, std::pair<K, V> const& item)
63
- {
64
- return str << '<' << item.first << ',' << item.second << '>';
65
- }
66
-
67
- namespace test_tools
68
- {
69
-
70
- // teach Boost.Test how to print std::pair with BOOST_REQUIRE_EQUAL
71
- template<>
72
- struct print_log_value<std::pair<int, int>>
73
- {
74
- void operator()(std::ostream& ostr, std::pair<int, int> const& item)
75
- {
76
- ostr << '<' << item.first << ',' << item.second << '>';
77
- }
78
- };
79
-
80
- } // namespace test_tools
81
- } // namespace boost
82
-
83
- #endif // BOOST_VERSION
84
-
85
- #define REQUIRE_EQUAL_CONTAINERS(left_, right_) \
86
- BOOST_REQUIRE_EQUAL_COLLECTIONS(left_.begin(), left_.end(), right_.begin(), right_.end())
87
-
88
- #endif
@@ -1,26 +0,0 @@
1
- import java.util.Arrays;
2
-
3
- public class PascalsTriangle {
4
-
5
- public static int[][] computeTriangle(int rows) {
6
- if (rows < 0) {
7
- throw new IllegalArgumentException("Rows can't be negative!");
8
- }
9
-
10
- int[][] triangle = new int[rows][];
11
-
12
- for (int i = 0; i < rows; i++) {
13
- triangle[i] = new int[i + 1];
14
- triangle[i][0] = 1;
15
- for (int j = 1; j < i; j++) {
16
- triangle[i][j] = triangle[i - 1][j - 1] + triangle[i - 1][j];
17
- }
18
- triangle[i][i] = 1;
19
- }
20
- return triangle;
21
- }
22
-
23
- public static boolean isTriangle(int[][] triangle) {
24
- return Arrays.deepEquals(triangle, computeTriangle(triangle.length));
25
- }
26
- }
@@ -1,85 +0,0 @@
1
- import org.junit.Test;
2
- import org.junit.Ignore;
3
- import org.junit.Rule;
4
- import org.junit.rules.ExpectedException;
5
-
6
-
7
- import static org.junit.Assert.assertArrayEquals;
8
- import static org.junit.Assert.assertEquals;
9
-
10
- public class PascalsTriangleTest {
11
-
12
- @Rule
13
- public ExpectedException thrown = ExpectedException.none();
14
-
15
- @Test
16
- public void testTriangleWithFourRows() {
17
- int[][] expectedOutput = new int[][]{
18
- {1},
19
- {1, 1},
20
- {1, 2, 1},
21
- {1, 3, 3, 1},
22
- };
23
-
24
- assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(4));
25
- }
26
-
27
- @Ignore
28
- @Test
29
- public void testTriangleWithSixRows() {
30
- int[][] expectedOutput = new int[][]{
31
- {1},
32
- {1, 1},
33
- {1, 2, 1},
34
- {1, 3, 3, 1},
35
- {1, 4, 6, 4, 1},
36
- {1, 5, 10, 10, 5, 1}
37
- };
38
-
39
- assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(6));
40
- }
41
-
42
- @Ignore
43
- @Test
44
- public void testExpectEmptyTriangle() {
45
- int[][] expectedOutput = new int[][]{
46
-
47
- };
48
-
49
- assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(0));
50
- }
51
-
52
- @Ignore
53
- @Test
54
- public void testValidInput() {
55
- int[][] input = new int[][]{
56
- {1},
57
- {1, 1},
58
- {1, 2, 1},
59
- {1, 3, 3, 1},
60
- {1, 4, 6, 4, 1},
61
- };
62
-
63
- assertEquals(true, PascalsTriangle.isTriangle(input));
64
- }
65
-
66
- @Ignore
67
- @Test
68
- public void testInvalidInput() {
69
- int[][] input = new int[][]{
70
- {1},
71
- {1, 1},
72
- {1, 2, 1},
73
- {1, 4, 4, 1},
74
- };
75
-
76
- assertEquals(false, PascalsTriangle.isTriangle(input));
77
- }
78
-
79
- @Ignore
80
- @Test
81
- public void testValidatesNotNegativeRows() {
82
- thrown.expect(IllegalArgumentException.class);
83
- PascalsTriangle.computeTriangle(-1);
84
- }
85
- }