trackler 2.0.6.29 → 2.0.6.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/README.md +2 -2
  4. data/tracks/c/config.json +7 -0
  5. data/tracks/c/exercises/binary/makefile +16 -0
  6. data/tracks/c/exercises/binary/src/example.c +17 -0
  7. data/tracks/c/exercises/binary/src/example.h +7 -0
  8. data/tracks/c/exercises/binary/test/test_binary.c +99 -0
  9. data/tracks/c/exercises/binary/test/vendor/unity.c +1300 -0
  10. data/tracks/c/exercises/binary/test/vendor/unity.h +274 -0
  11. data/tracks/c/exercises/binary/test/vendor/unity_internals.h +701 -0
  12. data/tracks/csharp/exercises/scrabble-score/ScrabbleScoreTest.cs +7 -0
  13. data/tracks/delphi/config.json +8 -0
  14. data/tracks/delphi/docs/RESOURCES.md +20 -0
  15. data/tracks/delphi/exercises/beer-song/uBeerSongTests.pas +48 -15
  16. data/tracks/delphi/exercises/hello-world/uHelloWorldExample.pas +2 -12
  17. data/tracks/delphi/exercises/hello-world/uTestHelloWorld.pas +3 -3
  18. data/tracks/delphi/exercises/rna-transcription/TestRnaTranscription.dpr +60 -0
  19. data/tracks/delphi/exercises/rna-transcription/uRnaTranscriptionExample.pas +55 -0
  20. data/tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas +88 -0
  21. data/tracks/go/config.json +4 -2
  22. data/tracks/julia/exercises/anagram/example.jl +29 -30
  23. data/tracks/julia/exercises/anagram/runtests.jl +16 -17
  24. data/tracks/julia/exercises/bob/example.jl +1 -1
  25. data/tracks/julia/exercises/hamming/example.jl +0 -1
  26. data/tracks/julia/exercises/leap/runtests.jl +4 -5
  27. data/tracks/julia/exercises/raindrops/example.jl +9 -9
  28. data/tracks/julia/exercises/raindrops/runtests.jl +54 -54
  29. data/tracks/julia/exercises/rna-transcription/example.jl +5 -6
  30. data/tracks/julia/exercises/rna-transcription/runtests.jl +22 -23
  31. data/tracks/julia/exercises/scrabble-score/example.jl +7 -7
  32. data/tracks/julia/exercises/scrabble-score/runtests.jl +12 -12
  33. data/tracks/julia/exercises/trinary/example.jl +2 -2
  34. data/tracks/julia/exercises/trinary/runtests.jl +11 -11
  35. data/tracks/julia/exercises/word-count/example.jl +7 -7
  36. data/tracks/julia/exercises/word-count/runtests.jl +11 -11
  37. data/tracks/scala/docs/INSTALLATION.md +18 -2
  38. metadata +12 -2
@@ -3,66 +3,65 @@ using Base.Test
3
3
  include("anagram.jl")
4
4
 
5
5
  @testset "no matches" begin
6
- @test detect_anagrams("diasper", ["hello", "world", "zombies", "pants"]) == []
6
+ @test detect_anagrams("diasper", ["hello", "world", "zombies", "pants"]) == []
7
7
  end
8
8
 
9
9
  @testset "detects simple anagram" begin
10
- @test detect_anagrams("ant", ["tan", "stand", "at"]) == ["tan"]
10
+ @test detect_anagrams("ant", ["tan", "stand", "at"]) == ["tan"]
11
11
  end
12
12
 
13
13
  @testset "does not detect false positives" begin
14
- @test detect_anagrams("galea", ["eagle"]) == []
14
+ @test detect_anagrams("galea", ["eagle"]) == []
15
15
  end
16
16
 
17
17
  @testset "detects multiple anagrams" begin
18
- @test detect_anagrams("master", ["stream", "pigeon", "maters"]) == ["stream", "maters"]
18
+ @test detect_anagrams("master", ["stream", "pigeon", "maters"]) == ["stream", "maters"]
19
19
  end
20
20
 
21
21
  @testset "does not detect anagram subsets" begin
22
- @test detect_anagrams("good", ["dog", "goody"]) == []
22
+ @test detect_anagrams("good", ["dog", "goody"]) == []
23
23
  end
24
24
 
25
25
  @testset "detects anagram" begin
26
- @test detect_anagrams("listen", ["enlists", "google", "inlets", "banana"]) == ["inlets"]
26
+ @test detect_anagrams("listen", ["enlists", "google", "inlets", "banana"]) == ["inlets"]
27
27
  end
28
28
 
29
29
  @testset "detects multiple anagrams" begin
30
- @test detect_anagrams("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]) == ["gallery", "regally", "largely"]
30
+ @test detect_anagrams("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]) == ["gallery", "regally", "largely"]
31
31
  end
32
32
 
33
33
  @testset "does not detect identical words" begin
34
- @test detect_anagrams("corn", ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]) == ["cron"]
34
+ @test detect_anagrams("corn", ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]) == ["cron"]
35
35
  end
36
36
 
37
37
  @testset "does not detect non-anagrams with identical checksum" begin
38
- @test detect_anagrams("mass", ["last"]) == []
38
+ @test detect_anagrams("mass", ["last"]) == []
39
39
  end
40
40
 
41
41
  @testset "detects anagrams case-insensitively" begin
42
- @test detect_anagrams("Orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"]
42
+ @test detect_anagrams("Orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"]
43
43
  end
44
44
 
45
45
  @testset "detects anagrams using case-insensitive subject" begin
46
- @test detect_anagrams("Orchestra", ["cashregister", "carthorse", "radishes"]) == ["carthorse"]
46
+ @test detect_anagrams("Orchestra", ["cashregister", "carthorse", "radishes"]) == ["carthorse"]
47
47
  end
48
48
 
49
49
  @testset "detects anagrams using case-insensitive possible matches" begin
50
- @test detect_anagrams("orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"]
50
+ @test detect_anagrams("orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"]
51
51
  end
52
52
 
53
53
  @testset "does not detect a word as its own anagram" begin
54
- @test detect_anagrams("banana", ["Banana"]) == []
54
+ @test detect_anagrams("banana", ["Banana"]) == []
55
55
  end
56
56
 
57
57
  @testset "does not detect a anagram if the original word is repeated" begin
58
- @test detect_anagrams("go", ["go Go GO"]) == []
58
+ @test detect_anagrams("go", ["go Go GO"]) == []
59
59
  end
60
60
 
61
61
  @testset "anagrams must use all letters exactly once" begin
62
- @test detect_anagrams("tapper", ["patter"]) == []
62
+ @test detect_anagrams("tapper", ["patter"]) == []
63
63
  end
64
64
 
65
65
  @testset "capital word is not own anagram" begin
66
- @test detect_anagrams("BANANA", ["Banana"]) == []
66
+ @test detect_anagrams("BANANA", ["Banana"]) == []
67
67
  end
68
-
@@ -25,6 +25,6 @@ function isshouting(stimulus::AbstractString)
25
25
  return false
26
26
  end
27
27
  end
28
-
28
+
29
29
  return true
30
30
  end
@@ -1,5 +1,4 @@
1
1
  function distance(s1::AbstractString, s2::AbstractString)
2
2
  length(s1) != length(s2) && throw(ArgumentError("Sequences must have the same length"))
3
-
4
3
  reduce(+, 0, a != b for (a, b) in zip(s1, s2))
5
4
  end
@@ -3,18 +3,17 @@ using Base.Test
3
3
  include("leap.jl")
4
4
 
5
5
  @testset "Year not divisible by 4: common year" begin
6
- @test !is_leap_year(2015)
6
+ @test !is_leap_year(2015)
7
7
  end
8
8
 
9
9
  @testset "Year divisible by 4, not divisible by 100: leap year" begin
10
- @test is_leap_year(2016)
10
+ @test is_leap_year(2016)
11
11
  end
12
12
 
13
13
  @testset "Year divisible by 100, not divisible by 400: common year" begin
14
- @test !is_leap_year(2100)
14
+ @test !is_leap_year(2100)
15
15
  end
16
16
 
17
17
  @testset "Year divisible by 400: leap year" begin
18
- @test is_leap_year(2000)
18
+ @test is_leap_year(2000)
19
19
  end
20
-
@@ -4,13 +4,13 @@
4
4
  # If the number does not have 3, 5, or 7 as a factor, just pass the number's digits straight through.
5
5
 
6
6
  function raindrops(number::Int)
7
- drops = []
8
- number % 3 == 0 && push!(drops, "Pling")
9
- number % 5 == 0 && push!(drops, "Plang")
10
- number % 7 == 0 && push!(drops, "Plong")
11
- if size(drops, 1) == 0
12
- repr(number)
13
- else
14
- join(drops)
15
- end
7
+ drops = []
8
+ number % 3 == 0 && push!(drops, "Pling")
9
+ number % 5 == 0 && push!(drops, "Plang")
10
+ number % 7 == 0 && push!(drops, "Plong")
11
+ if size(drops, 1) == 0
12
+ repr(number)
13
+ else
14
+ join(drops)
15
+ end
16
16
  end
@@ -3,70 +3,70 @@ using Base.Test
3
3
  include("raindrops.jl")
4
4
 
5
5
  @testset "detect numbers" begin
6
- @testset "the sound for 1 is 1" begin
7
- @test raindrops(1) == "1"
8
- end
9
- @testset "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" begin
10
- @test raindrops(8) == "8"
11
- end
12
- @testset "the sound for 52 is 52" begin
13
- @test raindrops(52) == "52"
14
- end
6
+ @testset "the sound for 1 is 1" begin
7
+ @test raindrops(1) == "1"
8
+ end
9
+ @testset "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" begin
10
+ @test raindrops(8) == "8"
11
+ end
12
+ @testset "the sound for 52 is 52" begin
13
+ @test raindrops(52) == "52"
14
+ end
15
15
  end
16
16
 
17
17
  @testset "detect pling" begin
18
- @testset "the sound for 3 is Pling" begin
19
- @test raindrops(3) == "Pling"
20
- end
21
- @testset "the sound for 6 is Pling as it has a factor 3" begin
22
- @test raindrops(6) == "Pling"
23
- end
24
- @testset "the sound for 9 is Pling as it has a factor 3" begin
25
- @test raindrops(9) == "Pling"
26
- end
27
- @testset "the sound for 27 is Pling as it has a factor 3" begin
28
- @test raindrops(27) == "Pling"
29
- end
18
+ @testset "the sound for 3 is Pling" begin
19
+ @test raindrops(3) == "Pling"
20
+ end
21
+ @testset "the sound for 6 is Pling as it has a factor 3" begin
22
+ @test raindrops(6) == "Pling"
23
+ end
24
+ @testset "the sound for 9 is Pling as it has a factor 3" begin
25
+ @test raindrops(9) == "Pling"
26
+ end
27
+ @testset "the sound for 27 is Pling as it has a factor 3" begin
28
+ @test raindrops(27) == "Pling"
29
+ end
30
30
  end
31
31
 
32
32
  @testset "detect plang" begin
33
- @testset "the sound for 5 is Plang" begin
34
- @test raindrops(5) == "Plang"
35
- end
36
- @testset "the sound for 10 is Plang as it has a factor 5" begin
37
- @test raindrops(10) == "Plang"
38
- end
39
- @testset "the sound for 25 is Plang as it has a factor 5" begin
40
- @test raindrops(25) == "Plang"
41
- end
42
- @testset "the sound for 3125 is Plang as it has a factor 5" begin
43
- @test raindrops(3125) == "Plang"
44
- end
33
+ @testset "the sound for 5 is Plang" begin
34
+ @test raindrops(5) == "Plang"
35
+ end
36
+ @testset "the sound for 10 is Plang as it has a factor 5" begin
37
+ @test raindrops(10) == "Plang"
38
+ end
39
+ @testset "the sound for 25 is Plang as it has a factor 5" begin
40
+ @test raindrops(25) == "Plang"
41
+ end
42
+ @testset "the sound for 3125 is Plang as it has a factor 5" begin
43
+ @test raindrops(3125) == "Plang"
44
+ end
45
45
  end
46
46
 
47
47
  @testset "detect plong" begin
48
- @testset "the sound for 7 is Plong" begin
49
- @test raindrops(7) == "Plong"
50
- end
51
- @testset "the sound for 14 is Plong as it has a factor of 7" begin
52
- @test raindrops(14) == "Plong"
53
- end
54
- @testset "the sound for 49 is Plong as it has a factor 7" begin
55
- @test raindrops(49) == "Plong"
56
- end
48
+ @testset "the sound for 7 is Plong" begin
49
+ @test raindrops(7) == "Plong"
50
+ end
51
+ @testset "the sound for 14 is Plong as it has a factor of 7" begin
52
+ @test raindrops(14) == "Plong"
53
+ end
54
+ @testset "the sound for 49 is Plong as it has a factor 7" begin
55
+ @test raindrops(49) == "Plong"
56
+ end
57
57
  end
58
58
 
59
59
  @testset "detect multiple sounds" begin
60
- @testset "the sound for 15 is PlingPlang as it has factors 3 and 5" begin
61
- @test raindrops(15) == "PlingPlang"
62
- end
63
- @testset "the sound for 21 is PlingPlong as it has factors 3 and 7" begin
64
- @test raindrops(21) == "PlingPlong"
65
- end
66
- @testset "the sound for 35 is PlangPlong as it has factors 5 and 7" begin
67
- @test raindrops(35) == "PlangPlong"
68
- end
69
- @testset "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" begin
70
- @test raindrops(105) == "PlingPlangPlong"
71
- end
60
+ @testset "the sound for 15 is PlingPlang as it has factors 3 and 5" begin
61
+ @test raindrops(15) == "PlingPlang"
62
+ end
63
+ @testset "the sound for 21 is PlingPlong as it has factors 3 and 7" begin
64
+ @test raindrops(21) == "PlingPlong"
65
+ end
66
+ @testset "the sound for 35 is PlangPlong as it has factors 5 and 7" begin
67
+ @test raindrops(35) == "PlangPlong"
68
+ end
69
+ @testset "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" begin
70
+ @test raindrops(105) == "PlingPlangPlong"
71
+ end
72
72
  end
@@ -1,10 +1,9 @@
1
1
  # Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
2
2
  # G -> C, C -> G, T -> A, A -> U
3
3
  function to_rna(dna::AbstractString)
4
- typeof(match(r"^[GCTA]+$", dna)) == Void && error("Invalid RNA strand")
5
- # Define character associations
6
- a_nucleotides = Dict('G'=>'C', 'C'=>'G', 'T'=>'A', 'A'=>'U')
7
- # Replace characters using dictionary
8
- map((x)->a_nucleotides[x], dna)
4
+ typeof(match(r"^[GCTA]+$", dna)) == Void && error("Invalid RNA strand")
5
+ # Define character associations
6
+ a_nucleotides = Dict('G'=>'C', 'C'=>'G', 'T'=>'A', 'A'=>'U')
7
+ # Replace characters using dictionary
8
+ map((x)->a_nucleotides[x], dna)
9
9
  end
10
-
@@ -3,38 +3,37 @@ using Base.Test
3
3
  include("rna-transcription.jl")
4
4
 
5
5
  @testset "basic transformations" begin
6
- @testset "rna complement of cytosine is guanine" begin
7
- @test to_rna("C") == "G"
8
- end
6
+ @testset "rna complement of cytosine is guanine" begin
7
+ @test to_rna("C") == "G"
8
+ end
9
9
 
10
- @testset "rna complement of guanine is cytosine" begin
11
- @test to_rna("G") == "C"
12
- end
10
+ @testset "rna complement of guanine is cytosine" begin
11
+ @test to_rna("G") == "C"
12
+ end
13
13
 
14
- @testset "rna complement of thymine is adenine" begin
15
- @test to_rna("T") == "A"
16
- end
14
+ @testset "rna complement of thymine is adenine" begin
15
+ @test to_rna("T") == "A"
16
+ end
17
17
 
18
- @testset "rna complement of adenine is uracil" begin
19
- @test to_rna("A") == "U"
20
- end
18
+ @testset "rna complement of adenine is uracil" begin
19
+ @test to_rna("A") == "U"
20
+ end
21
21
  end
22
22
 
23
23
  @testset "rna complement" begin
24
- @test to_rna("ACGTGGTCTTAA") == "UGCACCAGAAUU"
24
+ @test to_rna("ACGTGGTCTTAA") == "UGCACCAGAAUU"
25
25
  end
26
26
 
27
27
  @testset "error handling" begin
28
- @testset "dna correctly handles invalid input" begin
29
- @test_throws ErrorException to_rna("U")
30
- end
28
+ @testset "dna correctly handles invalid input" begin
29
+ @test_throws ErrorException to_rna("U")
30
+ end
31
31
 
32
- @testset "dna correctly handles completely invalid input" begin
33
- @test_throws ErrorException to_rna("XXX")
34
- end
32
+ @testset "dna correctly handles completely invalid input" begin
33
+ @test_throws ErrorException to_rna("XXX")
34
+ end
35
35
 
36
- @testset "dna correctly handles partially invalid input" begin
37
- @test_throws ErrorException to_rna("ACGTXXXCTTAA")
38
- end
36
+ @testset "dna correctly handles partially invalid input" begin
37
+ @test_throws ErrorException to_rna("ACGTXXXCTTAA")
38
+ end
39
39
  end
40
-
@@ -1,9 +1,9 @@
1
1
  function score(str::AbstractString)
2
- rank = Dict('a'=>1, 'e'=>1, 'i'=>1, 'o'=>1, 'u'=>1, 'l'=>1,
3
- 'n'=>1, 'r'=>1, 's'=>1, 't'=>1, 'd'=>2, 'g'=>2,
4
- 'b'=>3, 'c'=>3, 'm'=>3, 'p'=>3, 'f'=>4, 'h'=>4,
5
- 'v'=>4, 'w'=>4, 'y'=>4, 'k'=>5, 'j'=>8, 'x'=>8,
6
- 'q'=>10, 'z'=>10)
7
- length(str) == 0 && return 0
8
- mapreduce(x->get(rank, x, 0), +, lowercase(str))
2
+ rank = Dict('a'=>1, 'e'=>1, 'i'=>1, 'o'=>1, 'u'=>1, 'l'=>1,
3
+ 'n'=>1, 'r'=>1, 's'=>1, 't'=>1, 'd'=>2, 'g'=>2,
4
+ 'b'=>3, 'c'=>3, 'm'=>3, 'p'=>3, 'f'=>4, 'h'=>4,
5
+ 'v'=>4, 'w'=>4, 'y'=>4, 'k'=>5, 'j'=>8, 'x'=>8,
6
+ 'q'=>10, 'z'=>10)
7
+ length(str) == 0 && return 0
8
+ mapreduce(x->get(rank, x, 0), +, lowercase(str))
9
9
  end
@@ -3,49 +3,49 @@ using Base.Test
3
3
  include("scrabble-score.jl")
4
4
 
5
5
  @testset "lowercase letter" begin
6
- @test score("a") == 1
6
+ @test score("a") == 1
7
7
  end
8
8
 
9
9
  @testset "uppercase letter" begin
10
- @test score("A") == 1
10
+ @test score("A") == 1
11
11
  end
12
12
 
13
13
  @testset "valuable letter" begin
14
- @test score("f") == 4
14
+ @test score("f") == 4
15
15
  end
16
16
 
17
17
  @testset "short word" begin
18
- @test score("at") == 2
18
+ @test score("at") == 2
19
19
  end
20
20
 
21
21
  @testset "short, valuable word" begin
22
- @test score("zoo") == 12
22
+ @test score("zoo") == 12
23
23
  end
24
24
 
25
25
  @testset "medium word" begin
26
- @test score("street") == 6
26
+ @test score("street") == 6
27
27
  end
28
28
 
29
29
  @testset "medium, valuable word" begin
30
- @test score("quirky") == 22
30
+ @test score("quirky") == 22
31
31
  end
32
32
 
33
33
  @testset "long, mixed-case word" begin
34
- @test score("OxyphenButazone") == 41
34
+ @test score("OxyphenButazone") == 41
35
35
  end
36
36
 
37
37
  @testset "english-like word" begin
38
- @test score("pinata") == 8
38
+ @test score("pinata") == 8
39
39
  end
40
40
 
41
41
  @testset "non-english letter is not scored" begin
42
- @test score("piñata") == 7
42
+ @test score("piñata") == 7
43
43
  end
44
44
 
45
45
  @testset "empty input" begin
46
- @test score("") == 0
46
+ @test score("") == 0
47
47
  end
48
48
 
49
49
  @testset "entire alphabet available" begin
50
- @test score("abcdefghijklmnopqrstuvwxyz") == 87
50
+ @test score("abcdefghijklmnopqrstuvwxyz") == 87
51
51
  end
@@ -1,4 +1,4 @@
1
1
  function trinary_to_decimal(str::AbstractString)
2
- typeof(match(r"^[0-2]+$", str)) == Void && return 0
3
- mapreduce(i->(i[2]-'0')*3^i[1], +, zip(0:length(str), reverse(str)))
2
+ typeof(match(r"^[0-2]+$", str)) == Void && return 0
3
+ mapreduce(i->(i[2]-'0')*3^i[1], +, zip(0:length(str), reverse(str)))
4
4
  end
@@ -3,45 +3,45 @@ using Base.Test
3
3
  include("trinary.jl")
4
4
 
5
5
  @testset "trinary 1 is decimal 1" begin
6
- @test trinary_to_decimal("1") == 1
6
+ @test trinary_to_decimal("1") == 1
7
7
  end
8
8
 
9
9
  @testset "trinary 2 is decimal 2" begin
10
- @test trinary_to_decimal("2") == 2
10
+ @test trinary_to_decimal("2") == 2
11
11
  end
12
12
 
13
13
  @testset "trinary 10 is decimal 3" begin
14
- @test trinary_to_decimal("10") == 3
14
+ @test trinary_to_decimal("10") == 3
15
15
  end
16
16
 
17
17
  @testset "trinary 11 is decimal 4" begin
18
- @test trinary_to_decimal("11") == 4
18
+ @test trinary_to_decimal("11") == 4
19
19
  end
20
20
 
21
21
  @testset "trinary 100 is decimal 9" begin
22
- @test trinary_to_decimal("100") == 9
22
+ @test trinary_to_decimal("100") == 9
23
23
  end
24
24
 
25
25
  @testset "trinary 112 is decimal 14" begin
26
- @test trinary_to_decimal("112") == 14
26
+ @test trinary_to_decimal("112") == 14
27
27
  end
28
28
 
29
29
  @testset "trinary 222 is decimal 26" begin
30
- @test trinary_to_decimal("222") == 26
30
+ @test trinary_to_decimal("222") == 26
31
31
  end
32
32
 
33
33
  @testset "trinary 1122000120 is decimal 32091" begin
34
- @test trinary_to_decimal("1122000120") == 32091
34
+ @test trinary_to_decimal("1122000120") == 32091
35
35
  end
36
36
 
37
37
  @testset "invalid trinary digits returns 0" begin
38
- @test trinary_to_decimal("1234") == 0
38
+ @test trinary_to_decimal("1234") == 0
39
39
  end
40
40
 
41
41
  @testset "invalid word as input returns 0" begin
42
- @test trinary_to_decimal("carrot") == 0
42
+ @test trinary_to_decimal("carrot") == 0
43
43
  end
44
44
 
45
45
  @testset "invalid numbers with letters as input returns 0" begin
46
- @test trinary_to_decimal("0a1b2c") == 0
46
+ @test trinary_to_decimal("0a1b2c") == 0
47
47
  end