trackler 2.0.8.32 → 2.0.8.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fixtures/tracks/animal/exercises/fish/included-via-symlink.txt +1 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/elixir/config.json +14 -0
- data/tracks/elixir/exercises/change/change_test.exs +39 -39
- data/tracks/elixir/exercises/perfect-numbers/example.exs +34 -0
- data/tracks/elixir/exercises/perfect-numbers/perfect_numbers.exs +16 -0
- data/tracks/elixir/exercises/perfect-numbers/perfect_numbers_test.exs +84 -0
- data/tracks/elixir/exercises/pig-latin/example.exs +44 -0
- data/tracks/elixir/exercises/pig-latin/pig_latin.exs +20 -0
- data/tracks/elixir/exercises/pig-latin/pig_latin_test.exs +121 -0
- data/tracks/erlang/README.md +1 -1
- data/tracks/erlang/SETUP.md +29 -11
- data/tracks/erlang/docs/INSTALLATION.md +2 -6
- data/tracks/haskell/exercises/pov/.dummylink +1 -0
- data/tracks/java/exercises/sieve/src/test/java/SieveTest.java +2 -1
- data/tracks/kotlin/exercises/allergies/src/example/kotlin/Allergen.kt +10 -0
- data/tracks/python/docs/INSTALLATION.md +3 -8
- data/tracks/python/exercises/gigasecond/gigasecond_test.py +9 -6
- metadata +9 -3
- data/fixtures/tracks/animal/exercises/fish/included-via-symlink.txt +0 -1
- data/tracks/haskell/exercises/pov/.dummylink +0 -1
- data/tracks/kotlin/exercises/allergies/src/example/kotlin/Allergen.kt +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 378ca12e2afc9bb24632918400f6eda2a274edbe
|
4
|
+
data.tar.gz: 86c7fd6d6280d19c15a3e887f2bbd380442cec0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e407a254474cff7f8437b2e81e94e2e961cd744e14dd4c18636b73eba4a7b067a929e4cb258b8702f3a9ffaf0037fb710bb7da052acb2d78fe5c02a15a4a7f4
|
7
|
+
data.tar.gz: 837226938c97906142bb821b5917919562f475c7b0315c683a8e27b579cf7d4939fb341f188a39db94371fcb3e29adad6af0758525434f0f0017a9fd49a6230f
|
@@ -0,0 +1 @@
|
|
1
|
+
This should get included in fish.
|
data/lib/trackler/version.rb
CHANGED
data/tracks/elixir/config.json
CHANGED
@@ -35,6 +35,14 @@
|
|
35
35
|
"string processing"
|
36
36
|
]
|
37
37
|
},
|
38
|
+
{
|
39
|
+
"slug": "pig-latin",
|
40
|
+
"difficulty": 2,
|
41
|
+
"topics": [
|
42
|
+
"pattern matching",
|
43
|
+
"string processing"
|
44
|
+
]
|
45
|
+
},
|
38
46
|
{
|
39
47
|
"slug": "space-age",
|
40
48
|
"difficulty": 2,
|
@@ -318,6 +326,12 @@
|
|
318
326
|
"topics": [
|
319
327
|
]
|
320
328
|
},
|
329
|
+
{
|
330
|
+
"slug": "perfect-numbers",
|
331
|
+
"difficulty": 3,
|
332
|
+
"topics": [
|
333
|
+
]
|
334
|
+
},
|
321
335
|
{
|
322
336
|
"slug": "diffie-hellman",
|
323
337
|
"difficulty": 4,
|
@@ -9,69 +9,69 @@ defmodule ChangeTest do
|
|
9
9
|
use ExUnit.Case
|
10
10
|
|
11
11
|
# @tag :pending
|
12
|
-
test "
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
test "single coin change" do
|
13
|
+
coins = [1, 5, 10, 25, 100]
|
14
|
+
expected = [25]
|
15
|
+
assert Change.generate(coins, 25) == {:ok, expected}
|
16
16
|
end
|
17
17
|
|
18
18
|
@tag :pending
|
19
|
-
test "
|
20
|
-
|
21
|
-
|
19
|
+
test "multiple coin change" do
|
20
|
+
coins = [1, 5, 10, 25, 100]
|
21
|
+
expected = [5, 10]
|
22
|
+
assert Change.generate(coins, 15) == {:ok, expected}
|
22
23
|
end
|
23
24
|
|
24
25
|
@tag :pending
|
25
|
-
test "
|
26
|
-
|
27
|
-
|
26
|
+
test "change with Lilliputian Coins" do
|
27
|
+
coins = [1, 4, 15, 20, 50]
|
28
|
+
expected = [4, 4, 15]
|
29
|
+
assert Change.generate(coins, 23) == {:ok, expected}
|
28
30
|
end
|
29
31
|
|
30
32
|
@tag :pending
|
31
|
-
test "
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
test "change with Lower Elbonia Coins" do
|
34
|
+
coins = [1, 5, 10, 21, 25]
|
35
|
+
expected = [21, 21, 21]
|
36
|
+
assert Change.generate(coins, 63) == {:ok, expected}
|
35
37
|
end
|
36
38
|
|
37
39
|
@tag :pending
|
38
|
-
test "
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
test "large target values" do
|
41
|
+
coins = [1, 2, 5, 10, 20, 50, 100]
|
42
|
+
expected = [2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100]
|
43
|
+
assert Change.generate(coins, 999) == {:ok, expected}
|
42
44
|
end
|
43
45
|
|
44
|
-
@tag :pending
|
45
|
-
test "possible change without unit coins available" do
|
46
|
-
coins = [2, 5, 10, 20, 50]
|
47
|
-
expected = [2, 2, 2, 5, 10]
|
48
|
-
assert Change.generate(coins, 21) == {:ok, expected}
|
49
|
-
end
|
50
|
-
|
51
46
|
@tag :pending
|
52
|
-
test "change
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
test "possible change without unit coins available" do
|
48
|
+
coins = [2, 5, 10, 20, 50]
|
49
|
+
expected = [2, 2, 2, 5, 10]
|
50
|
+
assert Change.generate(coins, 21) == {:ok, expected}
|
56
51
|
end
|
57
52
|
|
58
53
|
@tag :pending
|
59
|
-
test "
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
test "no coins make 0 change" do
|
55
|
+
coins = [1, 5, 10, 21, 25]
|
56
|
+
expected = []
|
57
|
+
assert Change.generate(coins, 0) == {:ok, expected}
|
63
58
|
end
|
64
59
|
|
65
60
|
@tag :pending
|
66
|
-
test "
|
67
|
-
|
68
|
-
|
69
|
-
assert Change.generate(coins, 999) == {:ok, expected}
|
61
|
+
test "error testing for change smaller than the smallest of coins" do
|
62
|
+
coins = [5, 10]
|
63
|
+
assert Change.generate(coins, 3) == {:error, "cannot change"}
|
70
64
|
end
|
71
65
|
|
72
66
|
@tag :pending
|
73
67
|
test "error if no combination can add up to target" do
|
74
|
-
|
75
|
-
|
68
|
+
coins = [5, 10]
|
69
|
+
assert Change.generate(coins, 94) == {:error, "cannot change"}
|
70
|
+
end
|
71
|
+
|
72
|
+
@tag :pending
|
73
|
+
test "cannot find negative change values" do
|
74
|
+
coins = [1, 2, 5]
|
75
|
+
assert Change.generate(coins, -5) == {:error, "cannot change"}
|
76
76
|
end
|
77
77
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
defmodule PerfectNumbers do
|
2
|
+
@doc """
|
3
|
+
Determine the aliquot sum of the given `number`, by summing all the factors
|
4
|
+
of `number`, aside from `number` itself.
|
5
|
+
|
6
|
+
Based on this sum, classify the number as:
|
7
|
+
|
8
|
+
:perfect if the aliquot sum is equal to `number`
|
9
|
+
:abundant if the aliquot sum is greater than `number`
|
10
|
+
:deficient if the aliquot sum is less than `number`
|
11
|
+
"""
|
12
|
+
@spec classify(number :: integer) :: ({ :ok, atom } | { :error, String.t() })
|
13
|
+
def classify(number) when number < 1, do: { :error, "Classification is only possible for natural numbers." }
|
14
|
+
def classify(number) do
|
15
|
+
{ :ok, number |> aliquot_sum |> do_classify(number) }
|
16
|
+
end
|
17
|
+
|
18
|
+
defp do_classify(aliquot, aliquot), do: :perfect
|
19
|
+
defp do_classify(aliquot, number) when aliquot > number, do: :abundant
|
20
|
+
defp do_classify(_, _), do: :deficient
|
21
|
+
|
22
|
+
defp aliquot_sum(number) do
|
23
|
+
number
|
24
|
+
|> factors
|
25
|
+
|> Enum.reject(&(&1 == number))
|
26
|
+
|> Enum.sum
|
27
|
+
end
|
28
|
+
|
29
|
+
defp factors(number), do: factors(number, div(number, 2))
|
30
|
+
defp factors(1, _), do: [1]
|
31
|
+
defp factors(_, 1), do: [1]
|
32
|
+
defp factors(number, i) when rem(number, i) == 0, do: [i | factors(number, i-1)]
|
33
|
+
defp factors(number, i), do: factors(number, i-1)
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
defmodule PerfectNumbers do
|
2
|
+
@doc """
|
3
|
+
Determine the aliquot sum of the given `number`, by summing all the factors
|
4
|
+
of `number`, aside from `number` itself.
|
5
|
+
|
6
|
+
Based on this sum, classify the number as:
|
7
|
+
|
8
|
+
:perfect if the aliquot sum is equal to `number`
|
9
|
+
:abundant if the aliquot sum is greater than `number`
|
10
|
+
:deficient if the aliquot sum is less than `number`
|
11
|
+
"""
|
12
|
+
@spec classify(number :: integer) :: ({ :ok, atom } | { :error, String.t() })
|
13
|
+
def classify(number) do
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
|
2
|
+
Code.load_file("perfect_numbers.exs", __DIR__)
|
3
|
+
end
|
4
|
+
|
5
|
+
ExUnit.start
|
6
|
+
ExUnit.configure exclude: :pending, trace: true
|
7
|
+
|
8
|
+
defmodule PerfectNumbersTest do
|
9
|
+
use ExUnit.Case
|
10
|
+
|
11
|
+
describe "Perfect numbers" do
|
12
|
+
#@tag :pending
|
13
|
+
test "Smallest perfect number is classified correctly" do
|
14
|
+
assert PerfectNumbers.classify(6) == { :ok, :perfect }
|
15
|
+
end
|
16
|
+
|
17
|
+
@tag :pending
|
18
|
+
test "Medium perfect number is classified correctly" do
|
19
|
+
assert PerfectNumbers.classify(28) == { :ok, :perfect }
|
20
|
+
end
|
21
|
+
|
22
|
+
@tag :pending
|
23
|
+
test "Large perfect number is classified correctly" do
|
24
|
+
assert PerfectNumbers.classify(33550336) == { :ok, :perfect }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "Abundant numbers" do
|
29
|
+
@tag :pending
|
30
|
+
test "Smallest abundant number is classified correctly" do
|
31
|
+
assert PerfectNumbers.classify(12) == { :ok, :abundant }
|
32
|
+
end
|
33
|
+
|
34
|
+
@tag :pending
|
35
|
+
test "Medium abundant number is classified correctly" do
|
36
|
+
assert PerfectNumbers.classify(30) == { :ok, :abundant }
|
37
|
+
end
|
38
|
+
|
39
|
+
@tag :pending
|
40
|
+
test "Large abundant number is classified correctly" do
|
41
|
+
assert PerfectNumbers.classify(33550335) == { :ok, :abundant }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "Deficient numbers" do
|
46
|
+
@tag :pending
|
47
|
+
test "Smallest prime deficient number is classified correctly" do
|
48
|
+
assert PerfectNumbers.classify(2) == { :ok, :deficient }
|
49
|
+
end
|
50
|
+
|
51
|
+
@tag :pending
|
52
|
+
test "Smallest non-prime deficient number is classified correctly" do
|
53
|
+
assert PerfectNumbers.classify(4) == { :ok, :deficient }
|
54
|
+
end
|
55
|
+
|
56
|
+
@tag :pending
|
57
|
+
test "Medium deficient number is classified correctly" do
|
58
|
+
assert PerfectNumbers.classify(32) == { :ok, :deficient }
|
59
|
+
end
|
60
|
+
|
61
|
+
@tag :pending
|
62
|
+
test "Large deficient number is classified correctly" do
|
63
|
+
assert PerfectNumbers.classify(33550337) == { :ok, :deficient }
|
64
|
+
end
|
65
|
+
|
66
|
+
@tag :pending
|
67
|
+
test "Edge case (no factors other than itself) is classified correctly" do
|
68
|
+
assert PerfectNumbers.classify(1) == { :ok, :deficient }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "Invalid inputs" do
|
73
|
+
@tag :pending
|
74
|
+
test "Zero is rejected (not a natural number)" do
|
75
|
+
assert PerfectNumbers.classify(0) == { :error, "Classification is only possible for natural numbers." }
|
76
|
+
end
|
77
|
+
|
78
|
+
@tag :pending
|
79
|
+
test "Negative integer is rejected (not a natural number)" do
|
80
|
+
assert PerfectNumbers.classify(-1) == { :error, "Classification is only possible for natural numbers." }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
defmodule PigLatin do
|
2
|
+
@doc """
|
3
|
+
Given a `phrase`, translate it a word at a time to Pig Latin.
|
4
|
+
|
5
|
+
Words beginning with consonants should have the consonant moved to the end of
|
6
|
+
the word, followed by "ay".
|
7
|
+
|
8
|
+
Words beginning with vowels (aeiou) should have "ay" added to the end of the
|
9
|
+
word.
|
10
|
+
|
11
|
+
Some groups of letters are treated like consonants, including "ch", "qu",
|
12
|
+
"squ", "th", "thr", and "sch".
|
13
|
+
|
14
|
+
Some groups are treated like vowels, including "yt" and "xr".
|
15
|
+
"""
|
16
|
+
@spec translate(phrase :: String.t()) :: String.t()
|
17
|
+
def translate(phrase) do
|
18
|
+
phrase
|
19
|
+
|> String.split(" ")
|
20
|
+
|> Enum.map_join(" ", &to_pig_latin/1)
|
21
|
+
end
|
22
|
+
|
23
|
+
@consonant_sounds ["ch", "sch", "qu", "squ", "thr", "th"]
|
24
|
+
@vowel_sounds ["xr", "yt"]
|
25
|
+
@consonants "bcdfghjklmnpqrstvwxyz" |> String.graphemes
|
26
|
+
@vowels "aeiou" |> String.graphemes
|
27
|
+
|
28
|
+
for sound <- @consonant_sounds do
|
29
|
+
defp to_pig_latin(unquote(sound) <> rest), do: "#{rest}#{unquote(sound)}ay"
|
30
|
+
end
|
31
|
+
|
32
|
+
for sound <- @vowel_sounds do
|
33
|
+
defp to_pig_latin(unquote(sound) <> rest), do: "#{unquote(sound)}#{rest}ay"
|
34
|
+
end
|
35
|
+
|
36
|
+
for sound <- @consonants do
|
37
|
+
defp to_pig_latin(unquote(sound) <> rest), do: "#{rest}#{unquote(sound)}ay"
|
38
|
+
end
|
39
|
+
|
40
|
+
for sound <- @vowels do
|
41
|
+
defp to_pig_latin(unquote(sound) <> rest), do: "#{unquote(sound)}#{rest}ay"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
defmodule PigLatin do
|
2
|
+
@doc """
|
3
|
+
Given a `phrase`, translate it a word at a time to Pig Latin.
|
4
|
+
|
5
|
+
Words beginning with consonants should have the consonant moved to the end of
|
6
|
+
the word, followed by "ay".
|
7
|
+
|
8
|
+
Words beginning with vowels (aeiou) should have "ay" added to the end of the
|
9
|
+
word.
|
10
|
+
|
11
|
+
Some groups of letters are treated like consonants, including "ch", "qu",
|
12
|
+
"squ", "th", "thr", and "sch".
|
13
|
+
|
14
|
+
Some groups are treated like vowels, including "yt" and "xr".
|
15
|
+
"""
|
16
|
+
@spec translate(phrase :: String.t()) :: String.t()
|
17
|
+
def translate(phrase) do
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,121 @@
|
|
1
|
+
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
|
2
|
+
Code.load_file("pig_latin.exs", __DIR__)
|
3
|
+
end
|
4
|
+
|
5
|
+
ExUnit.start
|
6
|
+
ExUnit.configure exclude: :pending, trace: true
|
7
|
+
|
8
|
+
defmodule PigLatinTest do
|
9
|
+
use ExUnit.Case
|
10
|
+
|
11
|
+
describe "ay is added to words that start with vowels" do
|
12
|
+
#@tag :pending
|
13
|
+
test "word beginning with a" do
|
14
|
+
assert PigLatin.translate("apple") == "appleay"
|
15
|
+
end
|
16
|
+
|
17
|
+
@tag :pending
|
18
|
+
test "word beginning with e" do
|
19
|
+
assert PigLatin.translate("ear") == "earay"
|
20
|
+
end
|
21
|
+
|
22
|
+
@tag :pending
|
23
|
+
test "word beginning with i" do
|
24
|
+
assert PigLatin.translate("igloo") == "iglooay"
|
25
|
+
end
|
26
|
+
|
27
|
+
@tag :pending
|
28
|
+
test "word beginning with o" do
|
29
|
+
assert PigLatin.translate("object") == "objectay"
|
30
|
+
end
|
31
|
+
|
32
|
+
@tag :pending
|
33
|
+
test "word beginning with u" do
|
34
|
+
assert PigLatin.translate("under") == "underay"
|
35
|
+
end
|
36
|
+
|
37
|
+
@tag :pending
|
38
|
+
test "word beginning with a vowel and followed by a qu" do
|
39
|
+
assert PigLatin.translate("equal") == "equalay"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "first letter and ay are moved to the end of words that start with consonants" do
|
44
|
+
@tag :pending
|
45
|
+
test "word beginning with p" do
|
46
|
+
assert PigLatin.translate("pig") == "igpay"
|
47
|
+
end
|
48
|
+
|
49
|
+
@tag :pending
|
50
|
+
test "word beginning with k" do
|
51
|
+
assert PigLatin.translate("koala") == "oalakay"
|
52
|
+
end
|
53
|
+
|
54
|
+
@tag :pending
|
55
|
+
test "word beginning with y" do
|
56
|
+
assert PigLatin.translate("yellow") == "ellowyay"
|
57
|
+
end
|
58
|
+
|
59
|
+
@tag :pending
|
60
|
+
test "word beginning with x" do
|
61
|
+
assert PigLatin.translate("xenon") == "enonxay"
|
62
|
+
end
|
63
|
+
|
64
|
+
@tag :pending
|
65
|
+
test "word beginning with q without a following u" do
|
66
|
+
assert PigLatin.translate("qat") == "atqay"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "some letter clusters are treated like a single consonant" do
|
71
|
+
@tag :pending
|
72
|
+
test "word beginning with ch" do
|
73
|
+
assert PigLatin.translate("chair") == "airchay"
|
74
|
+
end
|
75
|
+
|
76
|
+
@tag :pending
|
77
|
+
test "word beginning with qu" do
|
78
|
+
assert PigLatin.translate("queen") == "eenquay"
|
79
|
+
end
|
80
|
+
|
81
|
+
@tag :pending
|
82
|
+
test "word beginning with qu and a preceding consonant" do
|
83
|
+
assert PigLatin.translate("square") == "aresquay"
|
84
|
+
end
|
85
|
+
|
86
|
+
@tag :pending
|
87
|
+
test "word beginning with th" do
|
88
|
+
assert PigLatin.translate("therapy") == "erapythay"
|
89
|
+
end
|
90
|
+
|
91
|
+
@tag :pending
|
92
|
+
test "word beginning with thr" do
|
93
|
+
assert PigLatin.translate("thrush") == "ushthray"
|
94
|
+
end
|
95
|
+
|
96
|
+
@tag :pending
|
97
|
+
test "word beginning with sch" do
|
98
|
+
assert PigLatin.translate("school") == "oolschay"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "some letter clusters are treated like a single vowel" do
|
103
|
+
@tag :pending
|
104
|
+
test "word beginning with yt" do
|
105
|
+
assert PigLatin.translate("yttria") == "yttriaay"
|
106
|
+
end
|
107
|
+
|
108
|
+
@tag :pending
|
109
|
+
test "word beginning with xr" do
|
110
|
+
assert PigLatin.translate("xray") == "xrayay"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "phrases are translated" do
|
115
|
+
@tag :pending
|
116
|
+
test "a whole phrase" do
|
117
|
+
assert PigLatin.translate("quick fast run") == "ickquay astfay unray"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
data/tracks/erlang/README.md
CHANGED
data/tracks/erlang/SETUP.md
CHANGED
@@ -1,16 +1,34 @@
|
|
1
|
-
|
1
|
+
## Running tests
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
In order to run the tests, issue the following command from the exercise
|
4
|
+
directory:
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
```bash
|
7
|
+
$ rebar3 eunit
|
8
|
+
```
|
9
|
+
|
10
|
+
### Test versioning
|
11
|
+
|
12
|
+
Each problem defines a macro `TEST_VERSION` in the test file and
|
13
|
+
verifies that the solution defines and exports a function `test_version`
|
14
|
+
returning that same value.
|
15
|
+
|
16
|
+
To make this test pass, add the following to your solution:
|
8
17
|
|
9
|
-
|
10
|
-
|
11
|
-
exercises name.
|
18
|
+
```erlang
|
19
|
+
-export([test_version/0]).
|
12
20
|
|
13
|
-
|
14
|
-
|
15
|
-
erl -noshell -eval "eunit:test($EXERCISE, [verbose])" -s init stop
|
21
|
+
test_version() ->
|
22
|
+
1.
|
16
23
|
```
|
24
|
+
|
25
|
+
The benefit of this is that reviewers can see against which test version
|
26
|
+
an iteration was written if, for example, a previously posted solution
|
27
|
+
does not pass current tests.
|
28
|
+
|
29
|
+
## Questions?
|
30
|
+
|
31
|
+
For detailed information about the Erlang track, please refer to the
|
32
|
+
[help page](http://exercism.io/languages/erlang) on the Exercism site.
|
33
|
+
This covers the basic information on setting up the development
|
34
|
+
environment expected by the exercises.
|
@@ -9,16 +9,12 @@ Update your Homebrew to latest:
|
|
9
9
|
$ brew update
|
10
10
|
```
|
11
11
|
|
12
|
-
Install Erlang:
|
12
|
+
Install Erlang and Rebar3:
|
13
13
|
|
14
14
|
```bash
|
15
|
-
$ brew install erlang
|
15
|
+
$ brew install erlang rebar@3
|
16
16
|
```
|
17
17
|
|
18
|
-
Also fetch the latest `rebar3` from rebar3.org and put it somewhere in
|
19
|
-
your `$PATH` and make it executable. (PRs that describe this better or
|
20
|
-
via `brew` are welcome).
|
21
|
-
|
22
18
|
### On Linux
|
23
19
|
|
24
20
|
* Fedora 17+ and Fedora Rawhide: `sudo yum -y install erlang`
|
@@ -0,0 +1 @@
|
|
1
|
+
resolver: lts-8.2
|
@@ -2,6 +2,7 @@ import org.junit.Test;
|
|
2
2
|
import org.junit.Ignore;
|
3
3
|
|
4
4
|
import java.util.Arrays;
|
5
|
+
import java.util.Collections;
|
5
6
|
import java.util.List;
|
6
7
|
|
7
8
|
import static org.junit.Assert.assertEquals;
|
@@ -12,7 +13,7 @@ public class SieveTest {
|
|
12
13
|
@Test
|
13
14
|
public void findFirstPrime() {
|
14
15
|
Sieve sieve = new Sieve(2);
|
15
|
-
List<Integer> expectedOutput =
|
16
|
+
List<Integer> expectedOutput = Collections.singletonList(2);
|
16
17
|
|
17
18
|
assertEquals(expectedOutput, sieve.getPrimes());
|
18
19
|
}
|
@@ -1,10 +1,5 @@
|
|
1
|
-
|
1
|
+
## Installing Python
|
2
2
|
|
3
|
-
|
3
|
+
If Python isn't already available on your system follow the instructions at [the Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/starting/installation/) to install Python on your computer.
|
4
4
|
|
5
|
-
|
6
|
-
## Packages
|
7
|
-
|
8
|
-
The [Python Package Index](https://pypi.python.org/pypi) contains thousands of packages.
|
9
|
-
Pretty much each of them is installable with `pip install packagename`.
|
10
|
-
If you don't have __pip__ already, [get it now](https://pip.pypa.io/en/latest/installing.html)!
|
5
|
+
Exercism currently supports Python2.7 and Python 3.3+.
|
@@ -1,31 +1,34 @@
|
|
1
|
-
from datetime import datetime
|
2
1
|
import unittest
|
3
2
|
|
3
|
+
from datetime import datetime
|
4
|
+
|
4
5
|
from gigasecond import add_gigasecond
|
5
6
|
|
6
7
|
|
8
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
9
|
+
|
7
10
|
class GigasecondTest(unittest.TestCase):
|
8
|
-
def
|
11
|
+
def test_date_only_specification_of_time(self):
|
9
12
|
self.assertEqual(
|
10
13
|
add_gigasecond(datetime(2011, 4, 25)),
|
11
14
|
datetime(2043, 1, 1, 1, 46, 40))
|
12
15
|
|
13
|
-
def
|
16
|
+
def test_another_date_only_specification_of_time(self):
|
14
17
|
self.assertEqual(
|
15
18
|
add_gigasecond(datetime(1977, 6, 13)),
|
16
19
|
datetime(2009, 2, 19, 1, 46, 40))
|
17
20
|
|
18
|
-
def
|
21
|
+
def test_one_more_date_only_specification_of_time(self):
|
19
22
|
self.assertEqual(
|
20
23
|
add_gigasecond(datetime(1959, 7, 19)),
|
21
24
|
datetime(1991, 3, 27, 1, 46, 40))
|
22
25
|
|
23
|
-
def
|
26
|
+
def test_full_time_specified(self):
|
24
27
|
self.assertEqual(
|
25
28
|
add_gigasecond(datetime(2015, 1, 24, 22, 0, 0)),
|
26
29
|
datetime(2046, 10, 2, 23, 46, 40))
|
27
30
|
|
28
|
-
def
|
31
|
+
def test_full_time_with_day_roll_over(self):
|
29
32
|
self.assertEqual(
|
30
33
|
add_gigasecond(datetime(2015, 1, 24, 23, 59, 59)),
|
31
34
|
datetime(2046, 10, 3, 1, 46, 39))
|
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.33
|
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-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -2535,9 +2535,15 @@ files:
|
|
2535
2535
|
- tracks/elixir/exercises/pascals-triangle/example.exs
|
2536
2536
|
- tracks/elixir/exercises/pascals-triangle/pascals_triangle.exs
|
2537
2537
|
- tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
|
2538
|
+
- tracks/elixir/exercises/perfect-numbers/example.exs
|
2539
|
+
- tracks/elixir/exercises/perfect-numbers/perfect_numbers.exs
|
2540
|
+
- tracks/elixir/exercises/perfect-numbers/perfect_numbers_test.exs
|
2538
2541
|
- tracks/elixir/exercises/phone-number/example.exs
|
2539
2542
|
- tracks/elixir/exercises/phone-number/phone_number.exs
|
2540
2543
|
- tracks/elixir/exercises/phone-number/phone_number_test.exs
|
2544
|
+
- tracks/elixir/exercises/pig-latin/example.exs
|
2545
|
+
- tracks/elixir/exercises/pig-latin/pig_latin.exs
|
2546
|
+
- tracks/elixir/exercises/pig-latin/pig_latin_test.exs
|
2541
2547
|
- tracks/elixir/exercises/poker/example.exs
|
2542
2548
|
- tracks/elixir/exercises/poker/poker.exs
|
2543
2549
|
- tracks/elixir/exercises/poker/poker_test.exs
|
@@ -8703,7 +8709,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
8703
8709
|
version: '0'
|
8704
8710
|
requirements: []
|
8705
8711
|
rubyforge_project:
|
8706
|
-
rubygems_version: 2.
|
8712
|
+
rubygems_version: 2.4.5.1
|
8707
8713
|
signing_key:
|
8708
8714
|
specification_version: 4
|
8709
8715
|
summary: The Exercism exercises data
|
@@ -1 +0,0 @@
|
|
1
|
-
fixtures/tracks/animal/exercises/fish/../../.meta/include-in-fish.txt
|
@@ -1 +0,0 @@
|
|
1
|
-
tracks/haskell/exercises/pov/../../common/stack.yaml
|
@@ -1 +0,0 @@
|
|
1
|
-
tracks/kotlin/exercises/allergies/src/example/kotlin/../../main/kotlin/Allergen.kt
|