trackler 2.0.8.40 → 2.0.8.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/flatten-array/canonical-data.json +7 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/csharp/exercises/allergies/HINTS.md +1 -2
- data/tracks/csharp/exercises/palindrome-products/HINTS.md +4 -0
- data/tracks/purescript/config.json +8 -0
- data/tracks/purescript/exercises/allergies/bower.json +18 -0
- data/tracks/purescript/exercises/allergies/examples/src/Allergies.purs +31 -0
- data/tracks/purescript/exercises/allergies/src/Allergies.purs +4 -0
- data/tracks/purescript/exercises/allergies/test/Main.purs +108 -0
- data/tracks/python/exercises/etl/etl_test.py +32 -43
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher_test.py +8 -6
- data/tracks/python/exercises/roman-numerals/roman_numerals_test.py +2 -0
- data/tracks/python/exercises/rotational-cipher/rotational_cipher_test.py +7 -12
- data/tracks/python/exercises/scrabble-score/scrabble_score_test.py +26 -12
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d69353254fc4ffd4ba4aa0def00d3d50072abe6
|
4
|
+
data.tar.gz: b39816fc7ab3bc4e0dc967d164153ebc7ca966ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9847a2b2d9141ec9ec8ffbec5f31962cd80c787575f9ce16efef0c9ee50ed71b1d1c3adb019a3adfdad2fa6711a5ce349a5a7a535d1001194352f1484aac937a
|
7
|
+
data.tar.gz: dc710738809d474bac826e1b4fa261521da31dcb41fba063718a4bb4d8825569bead88b971bcc731a8e3f538a0963ba0eca33ccfdc77846452b98d623dfd691a
|
@@ -1,7 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"exercise": "flatten-array",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.1.0",
|
4
4
|
"cases": [
|
5
|
+
{
|
6
|
+
"description": "no nesting",
|
7
|
+
"property": "flatten",
|
8
|
+
"input": [0, 1, 2],
|
9
|
+
"expected": [0, 1, 2]
|
10
|
+
},
|
5
11
|
{
|
6
12
|
"description": "flattens array with just integers present",
|
7
13
|
"property": "flatten",
|
data/lib/trackler/version.rb
CHANGED
@@ -1,3 +1,2 @@
|
|
1
1
|
## Hints
|
2
|
-
This exercise requires you to use bitwise operations. For more information, see [this page]
|
3
|
-
(https://msdn.microsoft.com/en-us/library/6a71f45d.aspx).
|
2
|
+
This exercise requires you to use bitwise operations. For more information, see [this page](https://msdn.microsoft.com/en-us/library/6a71f45d.aspx).
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "allergies",
|
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-integers": "^2.1.1"
|
13
|
+
},
|
14
|
+
"devDependencies": {
|
15
|
+
"purescript-psci-support": "^2.0.0",
|
16
|
+
"purescript-test-unit": "^10.1.0"
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Allergies
|
2
|
+
( allergicTo
|
3
|
+
, list
|
4
|
+
) where
|
5
|
+
|
6
|
+
import Prelude
|
7
|
+
import Data.Array (filter)
|
8
|
+
import Data.Int.Bits ((.&.))
|
9
|
+
import Data.Map (fromFoldable, lookup)
|
10
|
+
import Data.Maybe (fromMaybe)
|
11
|
+
import Data.Tuple (Tuple(Tuple), fst)
|
12
|
+
|
13
|
+
weights :: Array (Tuple String Int)
|
14
|
+
weights =
|
15
|
+
[ Tuple "eggs" 1
|
16
|
+
, Tuple "peanuts" 2
|
17
|
+
, Tuple "shellfish" 4
|
18
|
+
, Tuple "strawberries" 8
|
19
|
+
, Tuple "tomatoes" 16
|
20
|
+
, Tuple "chocolate" 32
|
21
|
+
, Tuple "pollen" 64
|
22
|
+
, Tuple "cats" 128
|
23
|
+
]
|
24
|
+
|
25
|
+
allergicTo :: Int -> String -> Boolean
|
26
|
+
allergicTo score substance = fromMaybe false $ do
|
27
|
+
weight <- lookup substance (fromFoldable weights)
|
28
|
+
pure $ score .&. weight == weight
|
29
|
+
|
30
|
+
list :: Int -> Array String
|
31
|
+
list score = filter (allergicTo score) (map fst weights)
|
@@ -0,0 +1,108 @@
|
|
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 Allergies (allergicTo, list)
|
10
|
+
|
11
|
+
main :: Eff _ Unit
|
12
|
+
main = runTest do
|
13
|
+
|
14
|
+
suite "Allergies.allergicTo" do
|
15
|
+
|
16
|
+
test "no allergies means not allergic" $
|
17
|
+
Assert.equal false
|
18
|
+
(allergicTo 0 "peanuts")
|
19
|
+
|
20
|
+
test "no allergies means not allergic" $
|
21
|
+
Assert.equal false
|
22
|
+
(allergicTo 0 "cats")
|
23
|
+
|
24
|
+
test "no allergies means not allergic" $
|
25
|
+
Assert.equal false
|
26
|
+
(allergicTo 0 "strawberries")
|
27
|
+
|
28
|
+
test "is allergic to eggs" $
|
29
|
+
Assert.equal true
|
30
|
+
(allergicTo 1 "eggs")
|
31
|
+
|
32
|
+
test "allergic to eggs in addition to other stuff" $
|
33
|
+
Assert.equal true
|
34
|
+
(allergicTo 5 "eggs")
|
35
|
+
|
36
|
+
test "allergic to eggs in addition to other stuff" $
|
37
|
+
Assert.equal true
|
38
|
+
(allergicTo 5 "shellfish")
|
39
|
+
|
40
|
+
test "allergic to eggs in addition to other stuff" $
|
41
|
+
Assert.equal false
|
42
|
+
(allergicTo 5 "strawberries")
|
43
|
+
|
44
|
+
suite "Allergies.list" do
|
45
|
+
|
46
|
+
test "no allergies at all" $
|
47
|
+
Assert.equal [
|
48
|
+
]
|
49
|
+
(list 0)
|
50
|
+
|
51
|
+
test "allergic to just eggs" $
|
52
|
+
Assert.equal [ "eggs"
|
53
|
+
]
|
54
|
+
(list 1)
|
55
|
+
|
56
|
+
test "allergic to just peanuts" $
|
57
|
+
Assert.equal [ "peanuts"
|
58
|
+
]
|
59
|
+
(list 2)
|
60
|
+
|
61
|
+
test "allergic to just strawberries" $
|
62
|
+
Assert.equal [ "strawberries"
|
63
|
+
]
|
64
|
+
(list 8)
|
65
|
+
|
66
|
+
test "allergic to eggs and peanuts" $
|
67
|
+
Assert.equal [ "eggs"
|
68
|
+
, "peanuts"
|
69
|
+
]
|
70
|
+
(list 3)
|
71
|
+
|
72
|
+
test "allergic to more than eggs but not peanuts" $
|
73
|
+
Assert.equal [ "eggs"
|
74
|
+
, "shellfish"
|
75
|
+
]
|
76
|
+
(list 5)
|
77
|
+
|
78
|
+
test "allergic to lots of stuff" $
|
79
|
+
Assert.equal [ "strawberries"
|
80
|
+
, "tomatoes"
|
81
|
+
, "chocolate"
|
82
|
+
, "pollen"
|
83
|
+
, "cats"
|
84
|
+
]
|
85
|
+
(list 248)
|
86
|
+
|
87
|
+
test "allergic to everything" $
|
88
|
+
Assert.equal [ "eggs"
|
89
|
+
, "peanuts"
|
90
|
+
, "shellfish"
|
91
|
+
, "strawberries"
|
92
|
+
, "tomatoes"
|
93
|
+
, "chocolate"
|
94
|
+
, "pollen"
|
95
|
+
, "cats"
|
96
|
+
]
|
97
|
+
(list 255)
|
98
|
+
|
99
|
+
test "ignore non allergen score parts" $
|
100
|
+
Assert.equal [ "eggs"
|
101
|
+
, "shellfish"
|
102
|
+
, "strawberries"
|
103
|
+
, "tomatoes"
|
104
|
+
, "chocolate"
|
105
|
+
, "pollen"
|
106
|
+
, "cats"
|
107
|
+
]
|
108
|
+
(list 509)
|
@@ -1,53 +1,42 @@
|
|
1
1
|
import unittest
|
2
2
|
|
3
|
-
import
|
3
|
+
from etl import transform
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
def test_transform_one_value(self):
|
8
|
-
old = {1: ['WORLD']}
|
9
|
-
expected = {'world': 1}
|
10
|
-
|
11
|
-
self.assertEqual(etl.transform(old), expected)
|
12
|
-
|
13
|
-
def test_transform_more_values(self):
|
14
|
-
old = {1: ['WORLD', 'GSCHOOLERS']}
|
15
|
-
expected = {'world': 1, 'gschoolers': 1}
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
16
7
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
8
|
+
class TransformTest(unittest.TestCase):
|
9
|
+
def test_a_single_letter(self):
|
10
|
+
self.assertEqual(transform({1: ['A']}), {'a': 1})
|
11
|
+
|
12
|
+
def test_single_score_with_multiple_letters(self):
|
13
|
+
legacy_data = {1: ["A", "E", "I", "O", "U"]}
|
14
|
+
data = {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
|
15
|
+
self.assertEqual(transform(legacy_data), data)
|
16
|
+
|
17
|
+
def test_multiple_scores_with_multiple_letters(self):
|
18
|
+
legacy_data = {1: ["A", "E"], 2: ["D", "G"]}
|
19
|
+
data = {"a": 1, "d": 2, "e": 1, "g": 2}
|
20
|
+
self.assertEqual(transform(legacy_data), data)
|
21
|
+
|
22
|
+
def test_multiple_scores_with_differing_numbers_of_letters(self):
|
23
|
+
legacy_data = {
|
24
|
+
1: ["A", "E", "I", "O", "U", "L", "N", "R", "S", "T"],
|
25
|
+
2: ["D", "G"],
|
26
|
+
3: ["B", "C", "M", "P"],
|
27
|
+
4: ["F", "H", "V", "W", "Y"],
|
28
|
+
5: ["K"],
|
29
|
+
8: ["J", "X"],
|
30
|
+
10: ["Q", "Z"]
|
39
31
|
}
|
40
|
-
|
41
|
-
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"u": 1, "v": 4, "w": 4, "x": 8, "y": 4,
|
47
|
-
"z": 10
|
32
|
+
data = {
|
33
|
+
"a": 1, "b": 3, "c": 3, "d": 2, "e": 1, "f": 4,
|
34
|
+
"g": 2, "h": 4, "i": 1, "j": 8, "k": 5, "l": 1,
|
35
|
+
"m": 3, "n": 1, "o": 1, "p": 3, "q": 10, "r": 1,
|
36
|
+
"s": 1, "t": 1, "u": 1, "v": 4, "w": 4, "x": 8,
|
37
|
+
"y": 4, "z": 10
|
48
38
|
}
|
49
|
-
|
50
|
-
self.assertEqual(etl.transform(old), expected)
|
39
|
+
self.assertEqual(transform(legacy_data), data)
|
51
40
|
|
52
41
|
|
53
42
|
if __name__ == '__main__':
|
@@ -3,28 +3,30 @@ import unittest
|
|
3
3
|
from rail_fence_cipher 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 RailFenceTests(unittest.TestCase):
|
7
|
-
def
|
9
|
+
def test_to_encode_with_two_rails(self):
|
8
10
|
self.assertMultiLineEqual(
|
9
11
|
encode('XOXOXOXOXOXOXOXOXO', 2), 'XXXXXXXXXOOOOOOOOO')
|
10
12
|
|
11
|
-
def
|
13
|
+
def test_to_encode_with_three_rails(self):
|
12
14
|
self.assertMultiLineEqual(
|
13
15
|
encode('WEAREDISCOVEREDFLEEATONCE', 3),
|
14
16
|
'WECRLTEERDSOEEFEAOCAIVDEN')
|
15
17
|
|
16
|
-
def
|
18
|
+
def test_to_encode_with_ending_in_the_middle(self):
|
17
19
|
self.assertMultiLineEqual(encode('EXERCISES', 4), 'ESXIEECSR')
|
18
20
|
|
19
|
-
def
|
21
|
+
def test_to_decode_with_three_rails(self):
|
20
22
|
self.assertMultiLineEqual(
|
21
23
|
decode('TEITELHDVLSNHDTISEIIEA', 3), 'THEDEVILISINTHEDETAILS')
|
22
24
|
|
23
|
-
def
|
25
|
+
def test_to_decode_with_five_rails(self):
|
24
26
|
self.assertMultiLineEqual(
|
25
27
|
decode('EIEXMSMESAORIWSCE', 5), 'EXERCISMISAWESOME')
|
26
28
|
|
27
|
-
def
|
29
|
+
def test_to_decode_with_six_rails(self):
|
28
30
|
self.assertMultiLineEqual(
|
29
31
|
decode(
|
30
32
|
'133714114238148966225439541018335470986172518171757571896261',
|
@@ -3,6 +3,8 @@ import unittest
|
|
3
3
|
import rotational_cipher
|
4
4
|
|
5
5
|
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
|
+
|
6
8
|
class RotationalCipher(unittest.TestCase):
|
7
9
|
def test_rotate_a_by_1(self):
|
8
10
|
self.assertEqual(rotational_cipher.rotate('a', 1), 'b')
|
@@ -23,29 +25,22 @@ class RotationalCipher(unittest.TestCase):
|
|
23
25
|
self.assertEqual(rotational_cipher.rotate('OMG', 5), 'TRL')
|
24
26
|
|
25
27
|
def test_rotate_spaces(self):
|
26
|
-
self.assertEqual(rotational_cipher.rotate('O M G', 5),
|
27
|
-
'T R L')
|
28
|
+
self.assertEqual(rotational_cipher.rotate('O M G', 5), 'T R L')
|
28
29
|
|
29
30
|
def test_rotate_numbers(self):
|
30
31
|
self.assertEqual(
|
31
|
-
rotational_cipher.rotate(
|
32
|
-
'Testing 1 2 3 testing',
|
33
|
-
4),
|
32
|
+
rotational_cipher.rotate('Testing 1 2 3 testing', 4),
|
34
33
|
'Xiwxmrk 1 2 3 xiwxmrk')
|
35
34
|
|
36
35
|
def test_rotate_punctuation(self):
|
37
36
|
self.assertEqual(
|
38
|
-
rotational_cipher.rotate(
|
39
|
-
"Let's eat, Grandma!",
|
40
|
-
21),
|
37
|
+
rotational_cipher.rotate("Let's eat, Grandma!", 21),
|
41
38
|
"Gzo'n zvo, Bmviyhv!")
|
42
39
|
|
43
40
|
def test_rotate_all_letters(self):
|
44
41
|
self.assertEqual(
|
45
|
-
rotational_cipher.rotate(
|
46
|
-
"
|
47
|
-
" over the lazy dog.",
|
48
|
-
13),
|
42
|
+
rotational_cipher.rotate("The quick brown fox jumps"
|
43
|
+
" over the lazy dog.", 13),
|
49
44
|
"Gur dhvpx oebja sbk whzcf bire gur ynml qbt.")
|
50
45
|
|
51
46
|
|
@@ -3,28 +3,42 @@ import unittest
|
|
3
3
|
from scrabble_score import score
|
4
4
|
|
5
5
|
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
|
+
|
6
8
|
class WordTest(unittest.TestCase):
|
7
|
-
def
|
8
|
-
self.assertEqual(score(
|
9
|
-
|
10
|
-
|
11
|
-
self.assertEqual(score(
|
9
|
+
def test_lowercase_letter(self):
|
10
|
+
self.assertEqual(score("a"), 1)
|
11
|
+
|
12
|
+
def test_uppercase_letter(self):
|
13
|
+
self.assertEqual(score("A"), 1)
|
14
|
+
|
15
|
+
def test_valuable_letter(self):
|
16
|
+
self.assertEqual(score("f"), 4)
|
12
17
|
|
13
|
-
def
|
14
|
-
self.assertEqual(score(
|
18
|
+
def test_short_word(self):
|
19
|
+
self.assertEqual(score("at"), 2)
|
15
20
|
|
16
|
-
def
|
17
|
-
self.assertEqual(score(
|
21
|
+
def test_short_valuable_word(self):
|
22
|
+
self.assertEqual(score("zoo"), 12)
|
18
23
|
|
19
|
-
def
|
24
|
+
def test_medium_word(self):
|
20
25
|
self.assertEqual(score("street"), 6)
|
21
26
|
|
22
|
-
def
|
27
|
+
def test_medium_valuable_word(self):
|
23
28
|
self.assertEqual(score("quirky"), 22)
|
24
29
|
|
25
|
-
def
|
30
|
+
def test_long_mixed_case_word(self):
|
26
31
|
self.assertEqual(score("OxyphenButazone"), 41)
|
27
32
|
|
33
|
+
def test_english_like_word(self):
|
34
|
+
self.assertEqual(score("pinata"), 8)
|
35
|
+
|
36
|
+
def test_empty_input(self):
|
37
|
+
self.assertEqual(score(""), 0)
|
38
|
+
|
39
|
+
def test_entire_alphabet_available(self):
|
40
|
+
self.assertEqual(score("abcdefghijklmnopqrstuvwxyz"), 87)
|
41
|
+
|
28
42
|
|
29
43
|
if __name__ == '__main__':
|
30
44
|
unittest.main()
|
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.
|
4
|
+
version: 2.0.8.41
|
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-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1654,6 +1654,7 @@ files:
|
|
1654
1654
|
- tracks/csharp/exercises/ocr-numbers/OcrNumbers.csproj
|
1655
1655
|
- tracks/csharp/exercises/ocr-numbers/OcrNumbersTest.cs
|
1656
1656
|
- tracks/csharp/exercises/palindrome-products/Example.cs
|
1657
|
+
- tracks/csharp/exercises/palindrome-products/HINTS.md
|
1657
1658
|
- tracks/csharp/exercises/palindrome-products/PalindromeProducts.cs
|
1658
1659
|
- tracks/csharp/exercises/palindrome-products/PalindromeProducts.csproj
|
1659
1660
|
- tracks/csharp/exercises/palindrome-products/PalindromeTest.cs
|
@@ -6548,6 +6549,10 @@ files:
|
|
6548
6549
|
- tracks/purescript/exercises/acronym/examples/src/Acronym.purs
|
6549
6550
|
- tracks/purescript/exercises/acronym/src/Acronym.purs
|
6550
6551
|
- tracks/purescript/exercises/acronym/test/Main.purs
|
6552
|
+
- tracks/purescript/exercises/allergies/bower.json
|
6553
|
+
- tracks/purescript/exercises/allergies/examples/src/Allergies.purs
|
6554
|
+
- tracks/purescript/exercises/allergies/src/Allergies.purs
|
6555
|
+
- tracks/purescript/exercises/allergies/test/Main.purs
|
6551
6556
|
- tracks/purescript/exercises/atbash-cipher/bower.json
|
6552
6557
|
- tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs
|
6553
6558
|
- tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs
|