trackler 2.0.8.28 → 2.0.8.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +4 -1
  3. data/common/README.md +52 -0
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/ecmascript/config.json +7 -0
  6. data/tracks/ecmascript/exercises/perfect-numbers/example.js +68 -0
  7. data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +89 -0
  8. data/tracks/ecmascript/exercises/perfect-numbers/package.json +28 -0
  9. data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +75 -0
  10. data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +1 -1
  11. data/tracks/erlang/exercises/all-your-base/src/all_your_base.app.src +1 -1
  12. data/tracks/erlang/exercises/allergies/src/allergies.app.src +1 -1
  13. data/tracks/erlang/exercises/anagram/src/anagram.app.src +1 -1
  14. data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +1 -1
  15. data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +1 -1
  16. data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +1 -1
  17. data/tracks/erlang/exercises/bob/src/bob.app.src +1 -1
  18. data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +1 -1
  19. data/tracks/erlang/exercises/clock/src/clock.app.src +1 -1
  20. data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +1 -1
  21. data/tracks/erlang/exercises/etl/src/etl.app.src +1 -1
  22. data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +1 -1
  23. data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +1 -1
  24. data/tracks/erlang/exercises/grains/src/grains.app.src +1 -1
  25. data/tracks/erlang/exercises/hamming/src/hamming.app.src +1 -1
  26. data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +1 -1
  27. data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +1 -1
  28. data/tracks/erlang/exercises/leap/src/leap.app.src +1 -1
  29. data/tracks/erlang/exercises/luhn/src/luhn.app.src +1 -1
  30. data/tracks/erlang/exercises/meetup/src/meetup.app.src +1 -1
  31. data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +1 -1
  32. data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +1 -1
  33. data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +1 -1
  34. data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +1 -1
  35. data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +1 -1
  36. data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +1 -1
  37. data/tracks/erlang/exercises/rotational-cipher/src/rotational_cipher.app.src +1 -1
  38. data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +1 -1
  39. data/tracks/erlang/exercises/series/src/series.app.src +1 -1
  40. data/tracks/erlang/exercises/space-age/src/space_age.app.src +1 -1
  41. data/tracks/erlang/exercises/strain/src/strain.app.src +1 -1
  42. data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +1 -1
  43. data/tracks/erlang/exercises/triangle/src/triangle.app.src +1 -1
  44. data/tracks/erlang/exercises/word-count/src/word_count.app.src +1 -1
  45. data/tracks/erlang/exercises/zipper/src/zipper.app.src +1 -1
  46. data/tracks/go/exercises/hello-world/hello_world.go +10 -1
  47. data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +1 -0
  48. data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/src/LinkedList.hs +1 -0
  49. data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
  50. data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +1 -1
  51. data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +37 -1
  52. data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +13 -6
  53. data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +21 -13
  54. data/tracks/objective-c/exercises/atbash-cipher/AtbashCipherExample.m +1 -1
  55. data/tracks/objective-c/exercises/beer-song/BeerSongExample.m +1 -1
  56. data/tracks/objective-c/exercises/beer-song/BeerSongTest.m +4 -4
  57. data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +1 -1
  58. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +2 -1
  59. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +12 -25
  60. data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +32 -80
  61. data/tracks/objective-c/exercises/sublist/SublistTest.m +47 -70
  62. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -0
  63. data/tracks/perl6/exercises/allergies/Example.pm +3 -1
  64. data/tracks/perl6/exercises/allergies/allergies.t +187 -137
  65. data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -0
  66. data/tracks/perl6/exercises/anagram/Example.pm +15 -15
  67. data/tracks/perl6/exercises/anagram/anagram.t +164 -15
  68. data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -0
  69. data/tracks/perl6/exercises/atbash-cipher/Example.pm +2 -0
  70. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +109 -86
  71. data/tracks/perl6/exercises/grains/Example.pm +10 -9
  72. data/tracks/perl6/exercises/grains/Grains.pm6 +1 -0
  73. data/tracks/perl6/exercises/grains/grains.t +126 -18
  74. data/tracks/perl6/exercises/leap/Example.pm +9 -9
  75. data/tracks/perl6/exercises/leap/Leap.pm6 +4 -0
  76. data/tracks/perl6/exercises/leap/leap.t +61 -17
  77. data/tracks/perl6/exercises/phone-number/Example.pm +4 -28
  78. data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +4 -0
  79. data/tracks/perl6/exercises/phone-number/phone-number.t +102 -65
  80. data/tracks/perl6/exercises/raindrops/Example.pm +10 -8
  81. data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +4 -0
  82. data/tracks/perl6/exercises/raindrops/raindrops.t +153 -20
  83. data/tracks/perl6/exercises/rna-transcription/Example.pm +5 -7
  84. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +4 -0
  85. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +107 -11
  86. data/tracks/perl6/exercises/scrabble-score/Example.pm +14 -19
  87. data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +4 -0
  88. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +106 -15
  89. data/tracks/perl6/exercises/space-age/Example.pm +29 -13
  90. data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +22 -0
  91. data/tracks/perl6/exercises/space-age/space-age.t +90 -52
  92. data/tracks/perl6/exercises/word-count/Example.pm +4 -8
  93. data/tracks/perl6/exercises/word-count/WordCount.pm6 +4 -0
  94. data/tracks/perl6/exercises/word-count/word-count.t +149 -16
  95. data/tracks/perl6/exercises/wordy/Example.pm +13 -13
  96. data/tracks/perl6/exercises/wordy/Wordy.pm6 +4 -0
  97. data/tracks/perl6/exercises/wordy/wordy.t +140 -97
  98. data/tracks/purescript/config.json +7 -0
  99. data/tracks/purescript/exercises/atbash-cipher/bower.json +18 -0
  100. data/tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs +41 -0
  101. data/tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs +4 -0
  102. data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +64 -0
  103. data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +2 -0
  104. data/tracks/swift/exercises/grade-school/Tests/GradeSchoolTests/GradeSchoolTests.swift +1 -1
  105. metadata +22 -2
@@ -86,6 +86,13 @@
86
86
  "topics": [
87
87
  "dates"
88
88
  ]
89
+ },
90
+ {
91
+ "slug": "atbash-cipher",
92
+ "difficulty": 1,
93
+ "topics": [
94
+ "strings"
95
+ ]
89
96
  }
90
97
  ],
91
98
  "deprecated": [
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "atbash-cipher",
3
+ "ignore": [
4
+ "**/.*",
5
+ "node_modules",
6
+ "bower_components",
7
+ "output"
8
+ ],
9
+ "dependencies": {
10
+ "purescript-prelude": "^2.5.0",
11
+ "purescript-maps": "^2.1.2",
12
+ "purescript-unicode": "^2.0.2"
13
+ },
14
+ "devDependencies": {
15
+ "purescript-psci-support": "^2.0.0",
16
+ "purescript-test-unit": "^10.1.0"
17
+ }
18
+ }
@@ -0,0 +1,41 @@
1
+ module AtbashCipher
2
+ ( decode
3
+ , encode
4
+ ) where
5
+
6
+ import Prelude
7
+ import Data.Array (drop, filter, take, zip, (:))
8
+ import Data.Char.Unicode (isPunctuation, isSpace)
9
+ import Data.Map (Map, fromFoldable, lookup)
10
+ import Data.Maybe (Maybe)
11
+ import Data.String (fromCharArray, joinWith, toCharArray, toLower)
12
+ import Data.Traversable (traverse)
13
+
14
+ plain :: Array Char
15
+ plain = toCharArray "abcdefghijklmnopqrstuvwxyz0123456789"
16
+
17
+ cipher :: Array Char
18
+ cipher = toCharArray "zyxwvutsrqponmlkjihgfedcba0123456789"
19
+
20
+ decMap :: Map Char Char
21
+ decMap = fromFoldable (zip cipher plain)
22
+
23
+ encMap :: Map Char Char
24
+ encMap = fromFoldable (zip plain cipher)
25
+
26
+ decode :: String -> Maybe String
27
+ decode s = fromCharArray <$> dec (toCharArray s)
28
+ where dec = filter ((/=) ' ')
29
+ >>> traverse (_ `lookup` decMap)
30
+
31
+ chunks :: forall a. Int -> Array a -> Array (Array a)
32
+ chunks n [] = []
33
+ chunks n a = take n a : chunks n (drop n a)
34
+
35
+ encode :: String -> Maybe String
36
+ encode s = group <$> enc (toLower s # toCharArray)
37
+ where enc = filter (not (isPunctuation || isSpace))
38
+ >>> traverse (_ `lookup` encMap)
39
+ group = chunks 5
40
+ >>> map fromCharArray
41
+ >>> joinWith " "
@@ -0,0 +1,4 @@
1
+ module AtbashCipher
2
+ ( decode
3
+ , encode
4
+ ) where
@@ -0,0 +1,64 @@
1
+ module Test.Main where
2
+
3
+ import Prelude
4
+ import Control.Monad.Eff (Eff)
5
+ import Data.Maybe (Maybe(..))
6
+ import Test.Unit.Assert as Assert
7
+ import Test.Unit (suite, test)
8
+ import Test.Unit.Main (runTest)
9
+ import AtbashCipher (decode, encode)
10
+
11
+ main :: Eff _ Unit
12
+ main = runTest do
13
+
14
+ suite "AtbashCipher.encode" do
15
+
16
+ test "encode yes" $
17
+ Assert.equal (Just "bvh")
18
+ (encode "yes")
19
+
20
+ test "encode no" $
21
+ Assert.equal (Just "ml")
22
+ (encode "no")
23
+
24
+ test "encode OMG" $
25
+ Assert.equal (Just "lnt")
26
+ (encode "OMG")
27
+
28
+ test "encode spaces" $
29
+ Assert.equal (Just "lnt")
30
+ (encode "O M G")
31
+
32
+ test "encode mindblowingly" $
33
+ Assert.equal (Just "nrmwy oldrm tob")
34
+ (encode "mindblowingly")
35
+
36
+ test "encode numbers" $
37
+ Assert.equal (Just "gvhgr mt123 gvhgr mt")
38
+ (encode "Testing,1 2 3, testing.")
39
+
40
+ test "encode deep thought" $
41
+ Assert.equal (Just "gifgs rhurx grlm")
42
+ (encode "Truth is fiction.")
43
+
44
+ test "encode all the letters" $
45
+ Assert.equal (Just "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")
46
+ (encode "The quick brown fox jumps over the lazy dog.")
47
+
48
+ suite "AtbashCipher.decode" do
49
+
50
+ test "decode exercism" $
51
+ Assert.equal (Just "exercism")
52
+ (decode "vcvix rhn")
53
+
54
+ test "decode a sentence" $
55
+ Assert.equal (Just "anobstacleisoftenasteppingstone")
56
+ (decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v")
57
+
58
+ test "decode numbers" $
59
+ Assert.equal (Just "testing123testing")
60
+ (decode "gvhgr mt123 gvhgr mt")
61
+
62
+ test "decode all the letters" $
63
+ Assert.equal (Just "thequickbrownfoxjumpsoverthelazydog")
64
+ (decode "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")
@@ -3,6 +3,8 @@ import unittest
3
3
  from run_length_encoding import encode, decode
4
4
 
5
5
 
6
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
7
+
6
8
  class WordCountTests(unittest.TestCase):
7
9
  def test_encode_empty_string(self):
8
10
  self.assertMultiLineEqual(encode(''), '')
@@ -15,7 +15,7 @@ class GradeSchoolTests: XCTestCase {
15
15
  return result.count.toIntMax() == IntMax(expected.count)
16
16
  }
17
17
 
18
- func XCTAssertEqualCollection (_ collectionS: Set<String>?, _ collectionA: [String]? ) {
18
+ func XCTAssertEqualCollection<C:Collection> (_ collectionS: C?, _ collectionA: [String]? ) where C.Iterator.Element == String {
19
19
  XCTAssert(sameCollection(collectionS, collectionA))
20
20
  }
21
21
 
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.28
4
+ version: 2.0.8.29
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-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -2195,6 +2195,10 @@ files:
2195
2195
  - tracks/ecmascript/exercises/pascals-triangle/gulpfile.js
2196
2196
  - tracks/ecmascript/exercises/pascals-triangle/package.json
2197
2197
  - tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
2198
+ - tracks/ecmascript/exercises/perfect-numbers/example.js
2199
+ - tracks/ecmascript/exercises/perfect-numbers/gulpfile.js
2200
+ - tracks/ecmascript/exercises/perfect-numbers/package.json
2201
+ - tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js
2198
2202
  - tracks/ecmascript/exercises/phone-number/example.js
2199
2203
  - tracks/ecmascript/exercises/phone-number/gulpfile.js
2200
2204
  - tracks/ecmascript/exercises/phone-number/package.json
@@ -6141,10 +6145,13 @@ files:
6141
6145
  - tracks/perl6/exercises/all-your-base/AllYourBase.pm6
6142
6146
  - tracks/perl6/exercises/all-your-base/Example.pm
6143
6147
  - tracks/perl6/exercises/all-your-base/all-your-base.t
6148
+ - tracks/perl6/exercises/allergies/Allergies.pm6
6144
6149
  - tracks/perl6/exercises/allergies/Example.pm
6145
6150
  - tracks/perl6/exercises/allergies/allergies.t
6151
+ - tracks/perl6/exercises/anagram/Anagram.pm6
6146
6152
  - tracks/perl6/exercises/anagram/Example.pm
6147
6153
  - tracks/perl6/exercises/anagram/anagram.t
6154
+ - tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6
6148
6155
  - tracks/perl6/exercises/atbash-cipher/Example.pm
6149
6156
  - tracks/perl6/exercises/atbash-cipher/atbash-cipher.t
6150
6157
  - tracks/perl6/exercises/binary/Example.pm
@@ -6156,33 +6163,42 @@ files:
6156
6163
  - tracks/perl6/exercises/grade-school/GradeSchool.pm6
6157
6164
  - tracks/perl6/exercises/grade-school/grade-school.t
6158
6165
  - tracks/perl6/exercises/grains/Example.pm
6166
+ - tracks/perl6/exercises/grains/Grains.pm6
6159
6167
  - tracks/perl6/exercises/grains/grains.t
6160
6168
  - tracks/perl6/exercises/hello-world/Example.pm
6161
6169
  - tracks/perl6/exercises/hello-world/HelloWorld.pm6
6162
6170
  - tracks/perl6/exercises/hello-world/hello-world.t
6163
6171
  - tracks/perl6/exercises/leap/Example.pm
6172
+ - tracks/perl6/exercises/leap/Leap.pm6
6164
6173
  - tracks/perl6/exercises/leap/leap.t
6165
6174
  - tracks/perl6/exercises/linked-list/Example.pm6
6166
6175
  - tracks/perl6/exercises/linked-list/LinkedList.pm6
6167
6176
  - tracks/perl6/exercises/linked-list/linked-list.t
6168
6177
  - tracks/perl6/exercises/phone-number/Example.pm
6178
+ - tracks/perl6/exercises/phone-number/PhoneNumber.pm6
6169
6179
  - tracks/perl6/exercises/phone-number/phone-number.t
6170
6180
  - tracks/perl6/exercises/raindrops/Example.pm
6181
+ - tracks/perl6/exercises/raindrops/Raindrops.pm6
6171
6182
  - tracks/perl6/exercises/raindrops/raindrops.t
6172
6183
  - tracks/perl6/exercises/rna-transcription/Example.pm
6184
+ - tracks/perl6/exercises/rna-transcription/RNA.pm6
6173
6185
  - tracks/perl6/exercises/rna-transcription/rna-transcription.t
6174
6186
  - tracks/perl6/exercises/robot-name/Example.pm
6175
6187
  - tracks/perl6/exercises/robot-name/Robot.pm6
6176
6188
  - tracks/perl6/exercises/robot-name/robot-name.t
6177
6189
  - tracks/perl6/exercises/scrabble-score/Example.pm
6190
+ - tracks/perl6/exercises/scrabble-score/Scrabble.pm6
6178
6191
  - tracks/perl6/exercises/scrabble-score/scrabble-score.t
6179
6192
  - tracks/perl6/exercises/space-age/Example.pm
6193
+ - tracks/perl6/exercises/space-age/SpaceAge.pm6
6180
6194
  - tracks/perl6/exercises/space-age/space-age.t
6181
6195
  - tracks/perl6/exercises/trinary/Example.pm
6182
6196
  - tracks/perl6/exercises/trinary/trinary.t
6183
6197
  - tracks/perl6/exercises/word-count/Example.pm
6198
+ - tracks/perl6/exercises/word-count/WordCount.pm6
6184
6199
  - tracks/perl6/exercises/word-count/word-count.t
6185
6200
  - tracks/perl6/exercises/wordy/Example.pm
6201
+ - tracks/perl6/exercises/wordy/Wordy.pm6
6186
6202
  - tracks/perl6/exercises/wordy/wordy.t
6187
6203
  - tracks/perl6/img/icon.png
6188
6204
  - tracks/php/.editorconfig
@@ -6462,6 +6478,10 @@ files:
6462
6478
  - tracks/purescript/exercises/acronym/examples/src/Acronym.purs
6463
6479
  - tracks/purescript/exercises/acronym/src/Acronym.purs
6464
6480
  - tracks/purescript/exercises/acronym/test/Main.purs
6481
+ - tracks/purescript/exercises/atbash-cipher/bower.json
6482
+ - tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs
6483
+ - tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs
6484
+ - tracks/purescript/exercises/atbash-cipher/test/Main.purs
6465
6485
  - tracks/purescript/exercises/bob/bower.json
6466
6486
  - tracks/purescript/exercises/bob/examples/src/Bob.purs
6467
6487
  - tracks/purescript/exercises/bob/src/Bob.purs