trackler 2.0.6.10 → 2.0.6.11
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.
- checksums.yaml +4 -4
- data/common/exercises/circular-buffer/canonical-data.json +343 -0
- data/common/exercises/luhn/description.md +4 -1
- data/common/exercises/secret-handshake/canonical-data.json +67 -0
- data/common/exercises/secret-handshake/description.md +6 -8
- data/common/exercises/variable-length-quantity/canonical-data.json +147 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/ceylon/.gitignore +1 -0
- data/tracks/ceylon/.travis.yml +6 -1
- data/tracks/ceylon/README.md +143 -4
- data/tracks/ceylon/bin/test-all-exercises +13 -0
- data/tracks/ceylon/bin/test-exercise +30 -0
- data/tracks/ceylon/config.json +33 -3
- data/tracks/ceylon/{SETUP.md → exercises/TRACK_HINTS.md} +0 -0
- data/tracks/ceylon/exercises/anagram/example/Anagram.ceylon +8 -0
- data/tracks/ceylon/exercises/anagram/source/anagram/Anagram.ceylon +3 -0
- data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +47 -0
- data/tracks/ceylon/exercises/anagram/source/anagram/module.ceylon +3 -0
- data/tracks/ceylon/exercises/bracket-push/example/Brackets.ceylon +18 -0
- data/tracks/ceylon/exercises/bracket-push/example/module.ceylon +4 -0
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/Brackets.ceylon +3 -0
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +37 -0
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/module.ceylon +3 -0
- data/tracks/ceylon/exercises/leap/example/Leap.ceylon +3 -0
- data/tracks/ceylon/exercises/leap/source/leap/Leap.ceylon +3 -0
- data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +10 -0
- data/tracks/ceylon/exercises/leap/source/leap/module.ceylon +3 -0
- data/tracks/ceylon/exercises/sieve/example/Sieve.ceylon +24 -0
- data/tracks/ceylon/exercises/sieve/example/module.ceylon +4 -0
- data/tracks/ceylon/exercises/sieve/source/sieve/Sieve.ceylon +3 -0
- data/tracks/ceylon/exercises/sieve/source/sieve/SieveTest.ceylon +23 -0
- data/tracks/ceylon/exercises/sieve/source/sieve/module.ceylon +3 -0
- data/tracks/csharp/.travis.yml +4 -0
- data/tracks/elm/SETUP.md +5 -4
- data/tracks/fsharp/.travis.yml +4 -0
- data/tracks/go/config.json +6 -2
- data/tracks/go/exercises/luhn/example.go +5 -4
- data/tracks/go/exercises/luhn/luhn_test.go +18 -34
- data/tracks/java/exercises/word-count/src/test/java/WordCountTest.java +10 -13
- data/tracks/lua/docs/ABOUT.md +1 -1
- data/tracks/lua/docs/LEARNING.md +1 -0
- data/tracks/lua/docs/RESOURCES.md +6 -1
- data/tracks/lua/exercises/flatten-array/flatten-array_spec.lua +11 -0
- data/tracks/lua/exercises/luhn/example.lua +11 -27
- data/tracks/lua/exercises/luhn/luhn_spec.lua +12 -39
- data/tracks/ocaml/exercises/all-your-base/all_your_base.mli +0 -2
- data/tracks/ocaml/exercises/bracket-push/bracket_push.mli +0 -2
- data/tracks/ocaml/exercises/luhn/example.ml +12 -16
- data/tracks/ocaml/exercises/luhn/luhn.mli +1 -2
- data/tracks/ocaml/exercises/luhn/test.ml +15 -12
- data/tracks/php/config.json +8 -0
- data/tracks/php/exercises/grains/example.php +63 -0
- data/tracks/php/exercises/grains/grains_test.php +82 -0
- data/tracks/pony/config.json +26 -14
- data/tracks/pony/exercises/anagram/example.pony +17 -73
- data/tracks/pony/exercises/anagram/test.pony +6 -13
- data/tracks/pony/exercises/bob/example.pony +24 -24
- data/tracks/pony/exercises/bob/test.pony +16 -34
- data/tracks/pony/exercises/difference-of-squares/example.pony +13 -25
- data/tracks/pony/exercises/difference-of-squares/test.pony +9 -16
- data/tracks/pony/exercises/hamming/example.pony +8 -23
- data/tracks/pony/exercises/hamming/test.pony +16 -30
- data/tracks/pony/exercises/hello-world/example.pony +3 -9
- data/tracks/pony/exercises/hello-world/test.pony +2 -11
- data/tracks/pony/exercises/leap/example.pony +4 -10
- data/tracks/pony/exercises/leap/test.pony +2 -11
- data/tracks/ruby/lib/generator/command_line.rb +5 -6
- data/tracks/ruby/lib/generator/repository.rb +13 -13
- data/tracks/ruby/lib/tasks/exercise_test_tasks.rb +2 -4
- data/tracks/ruby/lib/tasks/exercise_tests_runner.rb +6 -8
- data/tracks/ruby/test/generator/repository_test.rb +26 -34
- data/tracks/rust/README.md +1 -1
- data/tracks/scheme/config.json +5 -0
- data/tracks/scheme/docs/ABOUT.md +7 -0
- data/tracks/scheme/exercises/scrabble-score/example.scm +16 -0
- data/tracks/scheme/exercises/scrabble-score/scrabble-score-test.scm +57 -0
- data/tracks/scheme/exercises/scrabble-score/scrabble-score.scm +2 -0
- metadata +33 -5
- data/tracks/ceylon/exercises/.keep +0 -0
- data/tracks/ceylon/img/.keep +0 -0
@@ -4,32 +4,25 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
8
|
test(_AnagramTest)
|
12
9
|
|
13
10
|
class iso _AnagramTest is UnitTest
|
14
|
-
"""
|
15
|
-
Test Anagram package
|
16
|
-
"""
|
17
|
-
|
18
11
|
fun name(): String => "anagram/Anagram"
|
19
12
|
|
20
|
-
fun apply(h: TestHelper)
|
13
|
+
fun apply(h: TestHelper) =>
|
21
14
|
let anagrams = ["banana", "bob", "sent", "sale", "ales"]
|
22
|
-
let
|
15
|
+
let empty = Array[String]
|
23
16
|
|
24
17
|
// Anagram should return an empty array if there are no anagrams
|
25
|
-
h.assert_array_eq[String](
|
18
|
+
h.assert_array_eq[String](empty, Anagram("bobs", anagrams))
|
26
19
|
// Anagram should ignore same words, those aren't anagrams
|
27
|
-
h.assert_array_eq[String](
|
20
|
+
h.assert_array_eq[String](empty, Anagram("banana", anagrams))
|
28
21
|
// Anagram shouldn't be based on checksum
|
29
|
-
h.assert_array_eq[String](
|
22
|
+
h.assert_array_eq[String](empty, Anagram("last", ["mass"]))
|
30
23
|
// Anagram should return an array of anagrams if present
|
31
24
|
h.assert_array_eq[String](["sent"], Anagram("nets", anagrams))
|
32
25
|
// Anagram should be case insensitive
|
33
|
-
h.assert_array_eq[String](["sent"],Anagram("nETs", anagrams))
|
26
|
+
h.assert_array_eq[String](["sent"], Anagram("nETs", anagrams))
|
34
27
|
// Anagram should return multiple anagrams
|
35
28
|
h.assert_array_eq[String](["sale", "ales"], Anagram("seal", anagrams))
|
@@ -1,33 +1,33 @@
|
|
1
|
-
use "
|
1
|
+
use "itertools"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
new create() =>
|
10
|
-
_default = "Whatever."
|
11
|
-
|
12
|
-
fun apply(phrase: String): String ? =>
|
13
|
-
if loud(phrase) then
|
3
|
+
primitive Bob
|
4
|
+
fun apply(phrase: String): String =>
|
5
|
+
if _silent(phrase) then
|
6
|
+
"Fine. Be that way!"
|
7
|
+
elseif _loud(phrase) then
|
14
8
|
"Whoa, chill out!"
|
15
|
-
elseif
|
9
|
+
elseif _question(phrase) then
|
16
10
|
"Sure."
|
17
|
-
elseif silent(phrase) then
|
18
|
-
"Fine. Be that way!"
|
19
11
|
else
|
20
|
-
|
12
|
+
"Whatever."
|
21
13
|
end
|
22
14
|
|
23
|
-
fun
|
24
|
-
(
|
15
|
+
fun _silent(phrase: String): Bool =>
|
16
|
+
phrase.clone().>strip() == ""
|
17
|
+
|
18
|
+
fun _loud(phrase: String): Bool =>
|
19
|
+
Iter[U8](phrase.values()).all(this~_not_lowercase())
|
20
|
+
and Iter[U8](phrase.values()).any(this~_is_letter())
|
25
21
|
|
26
|
-
fun
|
27
|
-
|
28
|
-
rephrase.reverse().at("?",0)
|
22
|
+
fun _not_lowercase(b: U8): Bool =>
|
23
|
+
(b < 'a') and ('z' > b)
|
29
24
|
|
25
|
+
fun _is_letter(b: U8): Bool =>
|
26
|
+
(('a' <= b) and (b <= 'z')) or (('A' <= b) and (b <= 'Z'))
|
30
27
|
|
31
|
-
fun
|
32
|
-
|
33
|
-
|
28
|
+
fun _question(phrase: String): Bool =>
|
29
|
+
try
|
30
|
+
Iter[U8](phrase.values()).last() == '?'
|
31
|
+
else
|
32
|
+
false
|
33
|
+
end
|
@@ -4,22 +4,16 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
|
-
test(
|
12
|
-
test(
|
13
|
-
test(
|
14
|
-
test(
|
8
|
+
test(_TestBobShout)
|
9
|
+
test(_TestBobQuestion)
|
10
|
+
test(_TestBobSilent)
|
11
|
+
test(_TestBobDefault)
|
15
12
|
|
16
|
-
class iso
|
17
|
-
""
|
18
|
-
Test matching when Bob is shouted at
|
19
|
-
"""
|
20
|
-
fun name(): String => "bob/Bob"
|
13
|
+
class iso _TestBobShout is UnitTest
|
14
|
+
fun name(): String => "bob/Bob (Whoa, chill out!)"
|
21
15
|
|
22
|
-
fun apply(h: TestHelper)
|
16
|
+
fun apply(h: TestHelper) =>
|
23
17
|
let shout_resp: String = "Whoa, chill out!"
|
24
18
|
|
25
19
|
h.assert_eq[String](shout_resp, Bob("WATCH OUT!"))
|
@@ -27,14 +21,10 @@ class iso _BobShoutTest is UnitTest
|
|
27
21
|
h.assert_eq[String](shout_resp, Bob("1, 2, 3 GO!"))
|
28
22
|
h.assert_eq[String](shout_resp, Bob("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"))
|
29
23
|
|
30
|
-
class iso
|
31
|
-
""
|
32
|
-
Test matching when Bob is questioned
|
33
|
-
"""
|
34
|
-
|
35
|
-
fun name(): String => "bob/Bob"
|
24
|
+
class iso _TestBobQuestion is UnitTest
|
25
|
+
fun name(): String => "bob/Bob (Sure.)"
|
36
26
|
|
37
|
-
fun apply(h: TestHelper)
|
27
|
+
fun apply(h: TestHelper) =>
|
38
28
|
let ques_resp: String = "Sure."
|
39
29
|
|
40
30
|
h.assert_eq[String](ques_resp, Bob("Does this cryogenic chamber make me look fat?"))
|
@@ -42,27 +32,19 @@ class iso _BobQuestionTest is UnitTest
|
|
42
32
|
h.assert_eq[String](ques_resp, Bob("4?"))
|
43
33
|
h.assert_eq[String](ques_resp, Bob("Wait! Hang on. Are you going to be OK?"))
|
44
34
|
|
45
|
-
class iso
|
46
|
-
""
|
47
|
-
Test matching when Bob faces silence
|
48
|
-
"""
|
35
|
+
class iso _TestBobSilent is UnitTest
|
36
|
+
fun name(): String => "bob/Bob (Fine. Be that way!)"
|
49
37
|
|
50
|
-
fun
|
51
|
-
|
52
|
-
fun apply(h: TestHelper): None ? =>
|
38
|
+
fun apply(h: TestHelper) =>
|
53
39
|
let silent_resp: String = "Fine. Be that way!"
|
54
40
|
|
55
41
|
h.assert_eq[String](silent_resp, Bob(""))
|
56
42
|
h.assert_eq[String](silent_resp, Bob(" "))
|
57
43
|
|
58
|
-
class iso
|
59
|
-
""
|
60
|
-
Test matching when Bob is defaulting
|
61
|
-
"""
|
62
|
-
|
63
|
-
fun name(): String => "bob/Bob"
|
44
|
+
class iso _TestBobDefault is UnitTest
|
45
|
+
fun name(): String => "bob/Bob (Whatever.)"
|
64
46
|
|
65
|
-
fun apply(h: TestHelper)
|
47
|
+
fun apply(h: TestHelper) =>
|
66
48
|
let default_resp: String = "Whatever."
|
67
49
|
|
68
50
|
h.assert_eq[String](default_resp, Bob("Tom-ay-to, tom-aaaah-to."))
|
@@ -1,31 +1,19 @@
|
|
1
1
|
use "collections"
|
2
|
+
use "itertools"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
new create(max: U32) =>
|
7
|
-
_max = max + 1
|
8
|
-
|
9
|
-
fun square_of_sums(): U32 =>
|
10
|
-
var sum: U32 = 0
|
11
|
-
let rng: Range[U32] = Range[U32](1, _max)
|
12
|
-
|
13
|
-
while rng.has_next() do
|
14
|
-
sum = sum + rng.next()
|
15
|
-
end
|
16
|
-
|
4
|
+
primitive Squares
|
5
|
+
fun square_of_sums(n: USize): USize =>
|
6
|
+
let sum = (n * (n + 1)) / 2
|
17
7
|
sum * sum
|
18
8
|
|
19
|
-
fun sum_of_squares():
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
9
|
+
fun sum_of_squares(n: USize): USize =>
|
10
|
+
try
|
11
|
+
Iter[USize](Range(0, n + 1))
|
12
|
+
.map[USize]({(x: USize): USize => x * x})
|
13
|
+
.fold[USize]({(acc: USize, x: USize): USize => acc + x}, 0)
|
14
|
+
else
|
15
|
+
0
|
26
16
|
end
|
27
17
|
|
28
|
-
|
29
|
-
|
30
|
-
fun difference(): U32 =>
|
31
|
-
square_of_sums() - sum_of_squares()
|
18
|
+
fun difference(n: USize): USize =>
|
19
|
+
square_of_sums(n) - sum_of_squares(n)
|
@@ -4,28 +4,21 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
8
|
test(_TestSquares)
|
12
9
|
|
13
10
|
class iso _TestSquares is UnitTest
|
14
|
-
"""
|
15
|
-
Test Difference of Squares package
|
16
|
-
"""
|
17
|
-
|
18
11
|
fun name(): String => "difference-of-squares/Squares"
|
19
12
|
|
20
13
|
fun apply(h: TestHelper) =>
|
21
|
-
h.assert_eq[
|
22
|
-
h.assert_eq[
|
23
|
-
h.assert_eq[
|
14
|
+
h.assert_eq[USize](225, Squares.square_of_sums(5))
|
15
|
+
h.assert_eq[USize](55, Squares.sum_of_squares(5))
|
16
|
+
h.assert_eq[USize](170, Squares.difference(5))
|
24
17
|
|
25
|
-
h.assert_eq[
|
26
|
-
h.assert_eq[
|
27
|
-
h.assert_eq[
|
18
|
+
h.assert_eq[USize](3025, Squares.square_of_sums(10))
|
19
|
+
h.assert_eq[USize](385, Squares.sum_of_squares(10))
|
20
|
+
h.assert_eq[USize](2640, Squares.difference(10))
|
28
21
|
|
29
|
-
h.assert_eq[
|
30
|
-
h.assert_eq[
|
31
|
-
h.assert_eq[
|
22
|
+
h.assert_eq[USize](25502500, Squares.square_of_sums(100))
|
23
|
+
h.assert_eq[USize](338350, Squares.sum_of_squares(100))
|
24
|
+
h.assert_eq[USize](25164150, Squares.difference(100))
|
@@ -1,26 +1,11 @@
|
|
1
1
|
use "collections"
|
2
|
+
use "itertools"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
new create() =>
|
7
|
-
_name = "Hamming"
|
8
|
-
|
9
|
-
fun apply(strand1: String, strand2: String): U8 ? =>
|
4
|
+
primitive HammingDistance
|
5
|
+
fun apply(strand1: String, strand2: String): USize ? =>
|
10
6
|
if (strand1.size() != strand2.size()) then error end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
var dist: U8 = U8(0)
|
17
|
-
var idx: ISize = 0
|
18
|
-
|
19
|
-
while idx < size.isize() do
|
20
|
-
if (strand1.at_offset(idx).ne(strand2.at_offset(idx))) then
|
21
|
-
dist = dist + 1
|
22
|
-
end
|
23
|
-
idx = idx + 1
|
24
|
-
end
|
25
|
-
|
26
|
-
dist
|
7
|
+
|
8
|
+
Iter[U8](strand1.values())
|
9
|
+
.zip[U8](strand2.values())
|
10
|
+
.filter({(t: (U8, U8)): Bool => t._1 != t._2})
|
11
|
+
.count()
|
@@ -4,37 +4,23 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
|
-
test(
|
12
|
-
test(_HammingParamTest)
|
13
|
-
|
14
|
-
class iso _HammingDistanceTest is UnitTest
|
15
|
-
"""
|
16
|
-
Test Hamming package returns the right distance
|
17
|
-
"""
|
18
|
-
fun name(): String => "hamming/Hamming"
|
8
|
+
test(_TestHammingDistance)
|
19
9
|
|
20
|
-
|
21
|
-
|
22
|
-
h.assert_eq[U8](0, Hamming("GGACTGA", "GGACTGA"))
|
23
|
-
h.assert_eq[U8](1, Hamming("A", "G"))
|
24
|
-
h.assert_eq[U8](2, Hamming("AG", "CT"))
|
25
|
-
h.assert_eq[U8](1, Hamming("AT", "CT"))
|
26
|
-
h.assert_eq[U8](1, Hamming("GGACG", "GGTCG"))
|
27
|
-
h.assert_eq[U8](2, Hamming("ACCAGGG", "ACTATGG"))
|
28
|
-
h.assert_eq[U8](1, Hamming("AGG", "AGA"))
|
29
|
-
h.assert_eq[U8](4, Hamming("GATACA", "GCATAA"))
|
30
|
-
h.assert_eq[U8](9, Hamming("GGACGGATTCTG", "AGGACGGATTCT"))
|
10
|
+
class iso _TestHammingDistance is UnitTest
|
11
|
+
fun name(): String => "hamming/HammingDistance"
|
31
12
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
13
|
+
fun apply(h: TestHelper) ? =>
|
14
|
+
h.assert_eq[USize](0, HammingDistance("A", "A"))
|
15
|
+
h.assert_eq[USize](0, HammingDistance("GGACTGA", "GGACTGA"))
|
16
|
+
h.assert_eq[USize](1, HammingDistance("A", "G"))
|
17
|
+
h.assert_eq[USize](2, HammingDistance("AG", "CT"))
|
18
|
+
h.assert_eq[USize](1, HammingDistance("AT", "CT"))
|
19
|
+
h.assert_eq[USize](1, HammingDistance("GGACG", "GGTCG"))
|
20
|
+
h.assert_eq[USize](2, HammingDistance("ACCAGGG", "ACTATGG"))
|
21
|
+
h.assert_eq[USize](1, HammingDistance("AGG", "AGA"))
|
22
|
+
h.assert_eq[USize](4, HammingDistance("GATACA", "GCATAA"))
|
23
|
+
h.assert_eq[USize](9, HammingDistance("GGACGGATTCTG", "AGGACGGATTCT"))
|
37
24
|
|
38
|
-
|
39
|
-
h.assert_error({()? =>
|
40
|
-
h.assert_error({()? => Hamming("GA", "GAC")})
|
25
|
+
h.assert_error({()? => HammingDistance("GAT", "GA")})
|
26
|
+
h.assert_error({()? => HammingDistance("GA", "GAC")})
|
@@ -4,21 +4,12 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
8
|
test(_TestHelloWorld)
|
12
9
|
|
13
10
|
class iso _TestHelloWorld is UnitTest
|
14
|
-
"""
|
15
|
-
Test HelloWorld package
|
16
|
-
"""
|
17
11
|
fun name(): String => "hello-world/HelloWorld"
|
18
12
|
|
19
13
|
fun apply(h: TestHelper) =>
|
20
|
-
|
21
|
-
|
22
|
-
h.assert_eq[String]("Hello, World!", hello.say_hello())
|
23
|
-
h.assert_eq[String]("Hello, Exercism!", hello.say_hello("Exercism"))
|
24
|
-
|
14
|
+
h.assert_eq[String]("Hello, World!", HelloWorld.hello())
|
15
|
+
h.assert_eq[String]("Hello, Exercism!", HelloWorld.hello("Exercism"))
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
true
|
6
|
-
elseif ((year % 100) != 0) and ((year % 4) == 0) then
|
7
|
-
true
|
8
|
-
else
|
9
|
-
false
|
10
|
-
end
|
1
|
+
primitive Leap
|
2
|
+
fun apply(year: USize): Bool =>
|
3
|
+
let has_factor = {(n: USize)(year): Bool => (year % n) == 0}
|
4
|
+
has_factor(4) and (not has_factor(100) or has_factor(400))
|
@@ -4,22 +4,13 @@ actor Main is TestList
|
|
4
4
|
new create(env: Env) =>
|
5
5
|
PonyTest(env, this)
|
6
6
|
|
7
|
-
new make() =>
|
8
|
-
None
|
9
|
-
|
10
7
|
fun tag tests(test: PonyTest) =>
|
11
|
-
test(
|
8
|
+
test(_TestLeap)
|
12
9
|
|
13
|
-
class iso
|
14
|
-
"""
|
15
|
-
Test Leap package
|
16
|
-
"""
|
10
|
+
class iso _TestLeap is UnitTest
|
17
11
|
fun name(): String => "leap/Leap"
|
18
12
|
|
19
13
|
fun apply(h: TestHelper) =>
|
20
|
-
// Note -> Current master-branch simplifies these functions to
|
21
|
-
// assert_true/false, and removes expect
|
22
|
-
// https://github.com/ponylang/ponyc/blob/master/packages/ponytest/helper.pony
|
23
14
|
h.assert_true(Leap(1996), "Testing a leap year")
|
24
15
|
h.assert_false(Leap(1997), "Testing an odd year")
|
25
16
|
h.assert_false(Leap(1998), "Testing a non-leap even year")
|
@@ -30,11 +30,10 @@ module Generator
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def repository
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
33
|
+
LoggingRepository.new(
|
34
|
+
repository: Repository.new(paths: @paths, exercise_name: @options[:exercise_name]),
|
35
|
+
logger: logger
|
36
|
+
)
|
38
37
|
end
|
39
38
|
|
40
39
|
def parse_options(args)
|
@@ -46,7 +45,7 @@ module Generator
|
|
46
45
|
def logger
|
47
46
|
logger = Logger.new($stdout)
|
48
47
|
logger.formatter = proc { |_severity, _datetime, _progname, msg| "#{msg}\n" }
|
49
|
-
logger.level = @options[:verbose] ? Logger::DEBUG : Logger::
|
48
|
+
logger.level = @options[:verbose] ? Logger::DEBUG : Logger::INFO
|
50
49
|
logger
|
51
50
|
end
|
52
51
|
|