trackler 2.0.6.29 → 2.0.6.30
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/lib/trackler/version.rb +1 -1
- data/tracks/c/README.md +2 -2
- data/tracks/c/config.json +7 -0
- data/tracks/c/exercises/binary/makefile +16 -0
- data/tracks/c/exercises/binary/src/example.c +17 -0
- data/tracks/c/exercises/binary/src/example.h +7 -0
- data/tracks/c/exercises/binary/test/test_binary.c +99 -0
- data/tracks/c/exercises/binary/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/binary/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/binary/test/vendor/unity_internals.h +701 -0
- data/tracks/csharp/exercises/scrabble-score/ScrabbleScoreTest.cs +7 -0
- data/tracks/delphi/config.json +8 -0
- data/tracks/delphi/docs/RESOURCES.md +20 -0
- data/tracks/delphi/exercises/beer-song/uBeerSongTests.pas +48 -15
- data/tracks/delphi/exercises/hello-world/uHelloWorldExample.pas +2 -12
- data/tracks/delphi/exercises/hello-world/uTestHelloWorld.pas +3 -3
- data/tracks/delphi/exercises/rna-transcription/TestRnaTranscription.dpr +60 -0
- data/tracks/delphi/exercises/rna-transcription/uRnaTranscriptionExample.pas +55 -0
- data/tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas +88 -0
- data/tracks/go/config.json +4 -2
- data/tracks/julia/exercises/anagram/example.jl +29 -30
- data/tracks/julia/exercises/anagram/runtests.jl +16 -17
- data/tracks/julia/exercises/bob/example.jl +1 -1
- data/tracks/julia/exercises/hamming/example.jl +0 -1
- data/tracks/julia/exercises/leap/runtests.jl +4 -5
- data/tracks/julia/exercises/raindrops/example.jl +9 -9
- data/tracks/julia/exercises/raindrops/runtests.jl +54 -54
- data/tracks/julia/exercises/rna-transcription/example.jl +5 -6
- data/tracks/julia/exercises/rna-transcription/runtests.jl +22 -23
- data/tracks/julia/exercises/scrabble-score/example.jl +7 -7
- data/tracks/julia/exercises/scrabble-score/runtests.jl +12 -12
- data/tracks/julia/exercises/trinary/example.jl +2 -2
- data/tracks/julia/exercises/trinary/runtests.jl +11 -11
- data/tracks/julia/exercises/word-count/example.jl +7 -7
- data/tracks/julia/exercises/word-count/runtests.jl +11 -11
- data/tracks/scala/docs/INSTALLATION.md +18 -2
- metadata +12 -2
@@ -57,4 +57,11 @@ public class ScrabbleScoreTest
|
|
57
57
|
{
|
58
58
|
Assert.That(Scrabble.Score("OXYPHENBUTAZONE"), Is.EqualTo(41));
|
59
59
|
}
|
60
|
+
|
61
|
+
[Ignore("Remove to run test")]
|
62
|
+
[Test]
|
63
|
+
public void Entire_alphabet()
|
64
|
+
{
|
65
|
+
Assert.That(Scrabble.Score("abcdefghijklmnopqrstuvwxyz"), Is.EqualTo(87));
|
66
|
+
}
|
60
67
|
}
|
data/tracks/delphi/config.json
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
## Recommended Learning Resources
|
2
|
+
|
3
|
+
The [Delphi Basics](http://www.delphibasics.co.uk/) is a good reference on Delphi.
|
4
|
+
|
5
|
+
I also recommend reading [delphi.about.com](http://delphi.about.com/)'s "[A Beginner's Guide to Delphi Programming](http://delphi.about.com/od/beginners/a/delphicourse.htm)", which is a nice primer to Delphi programming.
|
6
|
+
|
7
|
+
Here is a list of topics that you should find helpful from the beginner's guide mentioned above:
|
8
|
+
|
9
|
+
1. [String Handling Routines](http://delphi.about.com/od/beginners/fl/String-Handling-Routines-Delphi-Programming.htm)
|
10
|
+
2. [Ordinal Data Types](http://delphi.about.com/od/faqstipstricks/fl/Ordinal-Data-Types-in-Delphi.htm)
|
11
|
+
3. [Returning multiple values from a function](http://delphi.about.com/od/beginners/a/return-multiple-values-from-a-delphi-function.htm)
|
12
|
+
4. [Overloading and Default Parameters](http://delphi.about.com/od/objectpascalide/a/overloading.htm)
|
13
|
+
5. [Class and Record Helpers](http://delphi.about.com/od/oopindelphi/a/understanding-delphi-class-and-record-helpers.htm)
|
14
|
+
6. [Record Helpers for sets and other simple types](http://delphi.about.com/od/objectpascalide/a/delphi-record-helpers-for-sets-and-other-simple-types.htm)
|
15
|
+
7. [Using TDictionary hash tables](http://delphi.about.com/od/beginners/a/using-t-dictionary-hash-tables-in-delphi.htm)
|
16
|
+
8. [Understanding generic types](http://delphi.about.com/od/objectpascalide/a/understanding-generic-types-in-delphi.htm)
|
17
|
+
9. [Interfaces](http://delphi.about.com/od/oopindelphi/a/interfaces-in-delphi-programming-101.htm)
|
18
|
+
10. [More on Interfaces](http://delphi.about.com/od/oopindelphi/a/interfaces-delphi-programming-102.htm)
|
19
|
+
11. [Handling exceptions](http://delphi.about.com/od/objectpascalide/a/on-handling-exceptions-in-delphi-exception-handling.htm)
|
20
|
+
12. [Threading libraries](http://delphi.about.com/od/kbthread/tp/threading-libraries-for-Delphi.htm)
|
@@ -10,17 +10,23 @@ type
|
|
10
10
|
BeerSongTests = class(TObject)
|
11
11
|
public
|
12
12
|
[Test]
|
13
|
-
|
14
|
-
// [TestCase('verse 2', '2, 1')] //Uncomment to run test case
|
15
|
-
// [TestCase('verse 1', '1, 2')] //Uncomment to run test case
|
16
|
-
// [TestCase('verse 0', '0, 3')] //Uncomment to run test case
|
17
|
-
procedure Verse(const verseNumber: integer; const verseResult: integer);
|
13
|
+
procedure Verse_8;
|
18
14
|
|
19
15
|
[Test]
|
20
|
-
[Ignore
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
[Ignore('Comment this line to run this test')]
|
17
|
+
procedure Verse_2;
|
18
|
+
|
19
|
+
[Test]
|
20
|
+
[Ignore('Comment this line to run this test')]
|
21
|
+
procedure Verse_0;
|
22
|
+
|
23
|
+
[Test]
|
24
|
+
[Ignore('Comment this line to run this test')]
|
25
|
+
procedure Verse_8_to_6;
|
26
|
+
|
27
|
+
[Test]
|
28
|
+
[Ignore('Comment this line to run this test')]
|
29
|
+
procedure Verse_3_to_0;
|
24
30
|
end;
|
25
31
|
|
26
32
|
implementation
|
@@ -61,21 +67,48 @@ const verseResults: array[0..3] of string = ('8 bottles of beer on the wall, 8 b
|
|
61
67
|
'Go to the store and buy some more, 99 bottles of beer on the wall.' + sLineBreak +
|
62
68
|
sLineBreak);
|
63
69
|
|
64
|
-
procedure BeerSongTests.
|
70
|
+
procedure BeerSongTests.Verse_8;
|
71
|
+
var Expected,
|
72
|
+
Actual: string;
|
73
|
+
begin
|
74
|
+
Expected := verseResults[0];
|
75
|
+
Actual := Beer.Verse(8);
|
76
|
+
Assert.AreEqual(Expected, Actual);
|
77
|
+
end;
|
78
|
+
|
79
|
+
procedure BeerSongTests.Verse_2;
|
80
|
+
var Expected,
|
81
|
+
Actual: string;
|
82
|
+
begin
|
83
|
+
Expected := verseResults[1];
|
84
|
+
Actual := Beer.Verse(2);
|
85
|
+
Assert.AreEqual(Expected, Actual);
|
86
|
+
end;
|
87
|
+
|
88
|
+
procedure BeerSongTests.Verse_0;
|
89
|
+
var Expected,
|
90
|
+
Actual: string;
|
91
|
+
begin
|
92
|
+
Expected := verseResults[3];
|
93
|
+
Actual := Beer.Verse(0);
|
94
|
+
Assert.AreEqual(Expected, Actual);
|
95
|
+
end;
|
96
|
+
|
97
|
+
procedure BeerSongTests.Verse_8_to_6;
|
65
98
|
var Expected,
|
66
99
|
Actual: string;
|
67
100
|
begin
|
68
|
-
Expected :=
|
69
|
-
Actual := Beer.
|
101
|
+
Expected := singResults[0];
|
102
|
+
Actual := Beer.Sing(8, 6);
|
70
103
|
assert.AreEqual(Expected, Actual);
|
71
104
|
end;
|
72
105
|
|
73
|
-
procedure BeerSongTests.
|
106
|
+
procedure BeerSongTests.Verse_3_to_0;
|
74
107
|
var Expected,
|
75
108
|
Actual: string;
|
76
109
|
begin
|
77
|
-
Expected := singResults[
|
78
|
-
Actual := Beer.Sing(
|
110
|
+
Expected := singResults[1];
|
111
|
+
Actual := Beer.Sing(3, 0);
|
79
112
|
assert.AreEqual(Expected, Actual);
|
80
113
|
end;
|
81
114
|
|
@@ -1,22 +1,12 @@
|
|
1
|
-
//========================================================
|
2
|
-
// Example solution to exercise.
|
3
|
-
//
|
4
|
-
// A simple hello function would suffice, however this
|
5
|
-
// solution is mimicking the Ruby hello-world exercise
|
6
|
-
//========================================================
|
7
1
|
unit uHelloWorld;
|
8
2
|
|
9
3
|
interface
|
10
4
|
|
11
|
-
|
12
|
-
THelloWorld = class
|
13
|
-
public
|
14
|
-
class function hello(name: string='World'): string; static;
|
15
|
-
end;
|
5
|
+
function Hello(name: string='World'): string;
|
16
6
|
|
17
7
|
implementation
|
18
8
|
|
19
|
-
|
9
|
+
function Hello(name: string='World'): string;
|
20
10
|
begin
|
21
11
|
result := 'Hello, ' + name + '!';
|
22
12
|
end;
|
@@ -50,17 +50,17 @@ uses uHelloWorld;
|
|
50
50
|
|
51
51
|
procedure HelloWorldTest.test_no_name;
|
52
52
|
begin
|
53
|
-
assert.AreEqual('Hello, World!',
|
53
|
+
assert.AreEqual('Hello, World!', Hello);
|
54
54
|
end;
|
55
55
|
|
56
56
|
procedure HelloWorldTest.test_sample_name;
|
57
57
|
begin
|
58
|
-
assert.AreEqual('Hello, Alice!',
|
58
|
+
assert.AreEqual('Hello, Alice!',Hello('Alice'));
|
59
59
|
end;
|
60
60
|
|
61
61
|
procedure HelloWorldTest.test_other_sample_name;
|
62
62
|
begin
|
63
|
-
assert.AreEqual('Hello, Bob!',
|
63
|
+
assert.AreEqual('Hello, Bob!', Hello('Bob'));
|
64
64
|
end;
|
65
65
|
|
66
66
|
initialization
|
@@ -0,0 +1,60 @@
|
|
1
|
+
program TestRNATranscription;
|
2
|
+
|
3
|
+
{$IFNDEF TESTINSIGHT}
|
4
|
+
{$APPTYPE CONSOLE}
|
5
|
+
{$ENDIF}{$STRONGLINKTYPES ON}
|
6
|
+
uses
|
7
|
+
System.SysUtils,
|
8
|
+
{$IFDEF TESTINSIGHT}
|
9
|
+
TestInsight.DUnitX,
|
10
|
+
{$ENDIF }
|
11
|
+
DUnitX.Loggers.Console,
|
12
|
+
DUnitX.Loggers.Xml.NUnit,
|
13
|
+
DUnitX.TestFramework,
|
14
|
+
uTestRnaTranscription in 'uTestRnaTranscription.pas',
|
15
|
+
uRnaTranscription in 'uRnaTranscription.pas';
|
16
|
+
|
17
|
+
var
|
18
|
+
runner : ITestRunner;
|
19
|
+
results : IRunResults;
|
20
|
+
logger : ITestLogger;
|
21
|
+
nunitLogger : ITestLogger;
|
22
|
+
begin
|
23
|
+
{$IFDEF TESTINSIGHT}
|
24
|
+
TestInsight.DUnitX.RunRegisteredTests;
|
25
|
+
exit;
|
26
|
+
{$ENDIF}
|
27
|
+
try
|
28
|
+
//Check command line options, will exit if invalid
|
29
|
+
TDUnitX.CheckCommandLine;
|
30
|
+
//Create the test runner
|
31
|
+
runner := TDUnitX.CreateRunner;
|
32
|
+
//Tell the runner to use RTTI to find Fixtures
|
33
|
+
runner.UseRTTI := True;
|
34
|
+
//tell the runner how we will log things
|
35
|
+
//Log to the console window
|
36
|
+
logger := TDUnitXConsoleLogger.Create(true);
|
37
|
+
runner.AddLogger(logger);
|
38
|
+
//Generate an NUnit compatible XML File
|
39
|
+
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
40
|
+
runner.AddLogger(nunitLogger);
|
41
|
+
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
42
|
+
|
43
|
+
//Run tests
|
44
|
+
results := runner.Execute;
|
45
|
+
if not results.AllPassed then
|
46
|
+
System.ExitCode := EXIT_ERRORS;
|
47
|
+
|
48
|
+
{$IFNDEF CI}
|
49
|
+
//We don't want this happening when running under CI.
|
50
|
+
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
51
|
+
begin
|
52
|
+
System.Write('Done.. press <Enter> key to quit.');
|
53
|
+
System.Readln;
|
54
|
+
end;
|
55
|
+
{$ENDIF}
|
56
|
+
except
|
57
|
+
on E: Exception do
|
58
|
+
System.Writeln(E.ClassName, ': ', E.Message);
|
59
|
+
end;
|
60
|
+
end.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
unit uRnaTranscription;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses Generics.Collections;
|
5
|
+
|
6
|
+
type
|
7
|
+
complement = class
|
8
|
+
private
|
9
|
+
class var
|
10
|
+
fDnaToRna: TDictionary<char, char>;
|
11
|
+
public
|
12
|
+
class function OfDna(nucleotide: string): string; static;
|
13
|
+
end;
|
14
|
+
|
15
|
+
implementation
|
16
|
+
uses SysUtils;
|
17
|
+
|
18
|
+
class function complement.OfDna(nucleotide: string): string;
|
19
|
+
var i: integer;
|
20
|
+
lRNA: string;
|
21
|
+
elements: TArray<char>;
|
22
|
+
RNAelement: char;
|
23
|
+
begin
|
24
|
+
result := '';
|
25
|
+
lRNA := '';
|
26
|
+
if not trim(nucleotide).IsEmpty then
|
27
|
+
begin
|
28
|
+
fDnaToRna := TDictionary<char, char>.Create;
|
29
|
+
with fDnatoRna do
|
30
|
+
begin
|
31
|
+
add('G','C');
|
32
|
+
add('C','G');
|
33
|
+
add('T','A');
|
34
|
+
add('A','U');
|
35
|
+
end;
|
36
|
+
elements := nucleotide.ToUpper.ToCharArray;
|
37
|
+
i := 0;
|
38
|
+
while i <= high(elements) do
|
39
|
+
begin
|
40
|
+
if fDnaToRna.TryGetValue(elements[i],RNAelement) then
|
41
|
+
begin
|
42
|
+
lRNA := lRNA + RNAelement;
|
43
|
+
inc(i);
|
44
|
+
end
|
45
|
+
else
|
46
|
+
begin
|
47
|
+
lRNA := '';
|
48
|
+
break;
|
49
|
+
end;
|
50
|
+
end;
|
51
|
+
end;
|
52
|
+
result := lRNA;
|
53
|
+
end;
|
54
|
+
|
55
|
+
end.
|
@@ -0,0 +1,88 @@
|
|
1
|
+
unit uTestRnaTranscription;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses
|
5
|
+
DUnitX.TestFramework;
|
6
|
+
|
7
|
+
type
|
8
|
+
[TestFixture]
|
9
|
+
RnaTranscriptionTest = class(TObject)
|
10
|
+
public
|
11
|
+
[Test]
|
12
|
+
procedure Rna_complement_of_cytosine_is_guanine;
|
13
|
+
|
14
|
+
[Test]
|
15
|
+
[Ignore('Comment this line to run this test')]
|
16
|
+
procedure Rna_complement_of_guanine_is_cytosine;
|
17
|
+
|
18
|
+
[Test]
|
19
|
+
[Ignore('Comment this line to run this test')]
|
20
|
+
procedure Rna_complement_of_thymine_is_adenine;
|
21
|
+
|
22
|
+
[Test]
|
23
|
+
[Ignore('Comment this line to run this test')]
|
24
|
+
procedure Rna_complement_of_adenine_is_uracil;
|
25
|
+
|
26
|
+
[Test]
|
27
|
+
[Ignore('Comment this line to run this test')]
|
28
|
+
procedure Rna_complement;
|
29
|
+
|
30
|
+
[Test]
|
31
|
+
[Ignore('Comment this line to run this test')]
|
32
|
+
procedure Dna_correctly_handles_invalid_input;
|
33
|
+
|
34
|
+
[Test]
|
35
|
+
[Ignore('Comment this line to run this test')]
|
36
|
+
procedure Dna_correctly_handles_completely_invalid_input;
|
37
|
+
|
38
|
+
[Test]
|
39
|
+
[Ignore('Comment this line to run this test')]
|
40
|
+
procedure Dna_correctly_handles_partially_invalid_input;
|
41
|
+
end;
|
42
|
+
|
43
|
+
implementation
|
44
|
+
uses uRnaTranscription;
|
45
|
+
|
46
|
+
procedure RnaTranscriptionTest.Rna_complement_of_cytosine_is_guanine;
|
47
|
+
begin
|
48
|
+
Assert.AreEqual('G', complement.OfDna('C'));
|
49
|
+
end;
|
50
|
+
|
51
|
+
procedure RnaTranscriptionTest.Rna_complement_of_guanine_is_cytosine;
|
52
|
+
begin
|
53
|
+
Assert.AreEqual('C', complement.OfDna('G'));
|
54
|
+
end;
|
55
|
+
|
56
|
+
procedure RnaTranscriptionTest.Rna_complement_of_thymine_is_adenine;
|
57
|
+
begin
|
58
|
+
Assert.AreEqual('A', complement.OfDna('T'));
|
59
|
+
end;
|
60
|
+
|
61
|
+
procedure RnaTranscriptionTest.Rna_complement_of_adenine_is_uracil;
|
62
|
+
begin
|
63
|
+
Assert.AreEqual('U', complement.OfDna('A'));
|
64
|
+
end;
|
65
|
+
|
66
|
+
procedure RnaTranscriptionTest.Rna_complement;
|
67
|
+
begin
|
68
|
+
Assert.AreEqual('UGCACCAGAAUU', complement.OfDna('ACGTGGTCTTAA'));
|
69
|
+
end;
|
70
|
+
|
71
|
+
procedure RnaTranscriptionTest.Dna_correctly_handles_invalid_input;
|
72
|
+
begin
|
73
|
+
Assert.AreEqual('', complement.OfDna('U'));
|
74
|
+
end;
|
75
|
+
|
76
|
+
procedure RnaTranscriptionTest.Dna_correctly_handles_completely_invalid_input;
|
77
|
+
begin
|
78
|
+
Assert.AreEqual('', complement.OfDna('XXX'));
|
79
|
+
end;
|
80
|
+
|
81
|
+
procedure RnaTranscriptionTest.Dna_correctly_handles_partially_invalid_input;
|
82
|
+
begin
|
83
|
+
Assert.AreEqual('', complement.OfDna('ACGTXXXCTTAA'));
|
84
|
+
end;
|
85
|
+
|
86
|
+
initialization
|
87
|
+
TDUnitX.RegisterTestFixture(RnaTranscriptionTest);
|
88
|
+
end.
|
data/tracks/go/config.json
CHANGED
@@ -1,43 +1,42 @@
|
|
1
1
|
# Anagrams are two or more words that composed of the same characters but in a different order
|
2
2
|
|
3
3
|
function is_anagram(s1::AbstractString, s2::AbstractString)
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
# Disable case sensitivity
|
5
|
+
s1 = lowercase(s1)
|
6
|
+
s2 = lowercase(s2)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
# Similar and different-length strings are not anagrams
|
9
|
+
if length(s1) != length(s2) || s1 == s2
|
10
|
+
return false
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# Calculate count of every character in the first string
|
14
|
+
chr_count = Dict()
|
15
|
+
for c in s1
|
16
|
+
chr_count[c] = get(chr_count, c, 0) + 1
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
# Reduce the count by every character from the second string
|
20
|
+
for c in s2
|
21
|
+
t = get(chr_count, c, 0) - 1
|
22
|
+
if t < 0
|
23
|
+
# Got character that not exist in the first string
|
24
|
+
return false
|
25
|
+
else
|
26
|
+
chr_count[c] = t
|
27
|
+
end
|
27
28
|
end
|
28
|
-
end
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# Check all counts to be zeroes
|
31
|
+
return all(i->(i==0), values(chr_count))
|
32
32
|
end
|
33
33
|
|
34
34
|
function detect_anagrams(subject::AbstractString, candidates::AbstractArray)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
result = []
|
36
|
+
for candidate = candidates
|
37
|
+
if is_anagram(subject, candidate)
|
38
|
+
push!(result, candidate)
|
39
|
+
end
|
39
40
|
end
|
40
|
-
|
41
|
-
result
|
41
|
+
result
|
42
42
|
end
|
43
|
-
|