trackler 2.0.8.19 → 2.0.8.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/phone-number/canonical-data.json +2 -2
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/config.json +7 -0
- data/tracks/c/exercises/react/makefile +16 -0
- data/tracks/c/exercises/react/src/example.c +185 -0
- data/tracks/c/exercises/react/src/react.h +29 -0
- data/tracks/c/exercises/react/test/test_react.c +324 -0
- data/tracks/c/exercises/react/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/react/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/react/test/vendor/unity_internals.h +701 -0
- data/tracks/csharp/.travis.yml +2 -9
- data/tracks/csharp/appveyor.yml +3 -3
- data/tracks/csharp/build.cake +13 -4
- data/tracks/csharp/build.ps1 +56 -164
- data/tracks/csharp/build.sh +33 -78
- data/tracks/csharp/circle.yml +2 -4
- data/tracks/csharp/config.json +2 -1
- data/tracks/csharp/exercises/leap/LeapTest.cs +8 -8
- data/tracks/csharp/generators/CanonicalData.cs +19 -0
- data/tracks/csharp/generators/CanonicalDataCase.cs +24 -0
- data/tracks/csharp/generators/CanonicalDataCaseJsonConverter.cs +32 -0
- data/tracks/csharp/generators/CanonicalDataCasesJsonConverter.cs +30 -0
- data/tracks/csharp/generators/CanonicalDataParser.cs +28 -0
- data/tracks/csharp/generators/ExerciseCollection.cs +23 -0
- data/tracks/csharp/generators/Exercises/Exercise.cs +14 -0
- data/tracks/csharp/generators/Exercises/LeapExercise.cs +35 -0
- data/tracks/csharp/generators/Generators.csproj +12 -0
- data/tracks/csharp/generators/Generators.csproj.user +6 -0
- data/tracks/csharp/generators/Generators.sln +22 -0
- data/tracks/csharp/generators/Program.cs +59 -0
- data/tracks/csharp/generators/TestClass.cs +13 -0
- data/tracks/csharp/generators/TestClassRenderer.cs +36 -0
- data/tracks/csharp/generators/TestMethod.cs +9 -0
- data/tracks/csharp/generators/TestMethodNameTransformer.cs +11 -0
- data/tracks/csharp/generators/TestMethodRenderer.cs +18 -0
- data/tracks/csharp/generators/To.cs +7 -0
- data/tracks/csharp/generators/generate.ps1 +2 -0
- data/tracks/csharp/generators/generate.sh +4 -0
- data/tracks/delphi/config.json +8 -0
- data/tracks/delphi/exercises/phone-number/uPhoneNumberExample.pas +6 -6
- data/tracks/delphi/exercises/phone-number/uPhoneNumberTests.pas +28 -17
- data/tracks/delphi/exercises/roman-numerals/RomanNumerals.dpr +60 -0
- data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsExample.pas +49 -0
- data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +216 -0
- data/tracks/elixir/config.json +22 -0
- data/tracks/elixir/exercises/poker/example.exs +136 -0
- data/tracks/elixir/exercises/poker/poker.exs +34 -0
- data/tracks/elixir/exercises/poker/poker_test.exs +217 -0
- data/tracks/elixir/exercises/protein-translation/example.exs +62 -0
- data/tracks/elixir/exercises/protein-translation/protein_translation.exs +34 -0
- data/tracks/elixir/exercises/protein-translation/protein_translation_test.exs +87 -0
- data/tracks/elixir/exercises/say/example.exs +139 -0
- data/tracks/elixir/exercises/say/say.exs +8 -0
- data/tracks/elixir/exercises/say/say_test.exs +85 -0
- data/tracks/go/exercises/robot-name/example.go +2 -0
- data/tracks/go/exercises/robot-name/robot_name_test.go +9 -1
- data/tracks/go/exercises/roman-numerals/roman_numerals_test.go +4 -1
- data/tracks/go/exercises/saddle-points/saddle_points_test.go +6 -6
- data/tracks/php/config.json +7 -0
- data/tracks/php/exercises/grade-school/example.php +35 -0
- data/tracks/php/exercises/grade-school/grade-school_test.php +84 -0
- metadata +43 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
class School
|
4
|
+
{
|
5
|
+
private $database = array() ;
|
6
|
+
|
7
|
+
public function numberOfStudents()
|
8
|
+
{
|
9
|
+
return (count($this->database, COUNT_RECURSIVE) - count($this->database)) ;
|
10
|
+
}
|
11
|
+
|
12
|
+
public function add($student, $grade)
|
13
|
+
{
|
14
|
+
$this->database[$grade][] = $student ;
|
15
|
+
}
|
16
|
+
|
17
|
+
public function grade($grade)
|
18
|
+
{
|
19
|
+
return (array_key_exists($grade, $this->database) ? $this->database[$grade] : array()) ;
|
20
|
+
}
|
21
|
+
|
22
|
+
public function studentsByGradeAlphabetical()
|
23
|
+
{
|
24
|
+
$tmp = $this->database ;
|
25
|
+
ksort($tmp) ;
|
26
|
+
|
27
|
+
foreach ($tmp as $grade => $students) {
|
28
|
+
asort($students) ;
|
29
|
+
foreach ($students as $student) {
|
30
|
+
$res [ $grade ][] = $student ;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
return $res ;
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
require "grade-school.php";
|
4
|
+
use PHPUnit\Framework\TestCase;
|
5
|
+
|
6
|
+
class GradeSchoolTest extends TestCase
|
7
|
+
{
|
8
|
+
protected $school ;
|
9
|
+
|
10
|
+
protected function setUp()
|
11
|
+
{
|
12
|
+
$this->school = new School() ;
|
13
|
+
}
|
14
|
+
|
15
|
+
public function testNoStudent()
|
16
|
+
{
|
17
|
+
$this->assertEquals(0, $this->school->numberOfStudents());
|
18
|
+
}
|
19
|
+
|
20
|
+
public function testAddStudent()
|
21
|
+
{
|
22
|
+
$this->markTestSkipped();
|
23
|
+
|
24
|
+
$this->school->add("Claire", 2);
|
25
|
+
$this->assertContains('Claire', $this->school->grade(2));
|
26
|
+
}
|
27
|
+
|
28
|
+
public function testAddStudentsinSameGrade()
|
29
|
+
{
|
30
|
+
$this->markTestSkipped();
|
31
|
+
|
32
|
+
$this->school->add("Marc", 2);
|
33
|
+
$this->school->add("Virginie", 2);
|
34
|
+
$this->school->add("Claire", 2);
|
35
|
+
|
36
|
+
$students = $this->school->grade(2) ;
|
37
|
+
$this->assertCount(3, $students);
|
38
|
+
$this->assertEquals(
|
39
|
+
['Claire', 'Marc', 'Virginie'],
|
40
|
+
$students,
|
41
|
+
$message = '',
|
42
|
+
$delta = 0.0,
|
43
|
+
$maxDepth = 10,
|
44
|
+
$canonicalize = true
|
45
|
+
);
|
46
|
+
}
|
47
|
+
|
48
|
+
public function testAddStudentInDifferentGrades()
|
49
|
+
{
|
50
|
+
$this->markTestSkipped();
|
51
|
+
|
52
|
+
$this->school->add("Marc", 3);
|
53
|
+
$this->school->add("Claire", 6);
|
54
|
+
|
55
|
+
$this->assertContains('Marc', $this->school->grade(3));
|
56
|
+
$this->assertContains('Claire', $this->school->grade(6));
|
57
|
+
$this->assertNotContains('Marc', $this->school->grade(6));
|
58
|
+
$this->assertNotContains('Claire', $this->school->grade(3));
|
59
|
+
}
|
60
|
+
|
61
|
+
public function testEmptyGrade()
|
62
|
+
{
|
63
|
+
$this->markTestSkipped();
|
64
|
+
|
65
|
+
$this->assertEmpty($this->school->grade(1));
|
66
|
+
}
|
67
|
+
|
68
|
+
public function testSortSchool()
|
69
|
+
{
|
70
|
+
$this->markTestSkipped();
|
71
|
+
|
72
|
+
$this->school->add("Marc", 5);
|
73
|
+
$this->school->add("Virginie", 5);
|
74
|
+
$this->school->add("Claire", 5);
|
75
|
+
$this->school->add("Mehdi", 4);
|
76
|
+
|
77
|
+
$sortedStudents = [
|
78
|
+
4 => ['Mehdi'],
|
79
|
+
5 => ['Claire', 'Marc', 'Virginie']
|
80
|
+
];
|
81
|
+
$schoolStudents = $this->school->studentsByGradeAlphabetical() ;
|
82
|
+
$this->assertEquals($sortedStudents, $schoolStudents) ;
|
83
|
+
}
|
84
|
+
}
|
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.20
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -712,6 +712,13 @@ files:
|
|
712
712
|
- tracks/c/exercises/raindrops/test/vendor/unity.c
|
713
713
|
- tracks/c/exercises/raindrops/test/vendor/unity.h
|
714
714
|
- tracks/c/exercises/raindrops/test/vendor/unity_internals.h
|
715
|
+
- tracks/c/exercises/react/makefile
|
716
|
+
- tracks/c/exercises/react/src/example.c
|
717
|
+
- tracks/c/exercises/react/src/react.h
|
718
|
+
- tracks/c/exercises/react/test/test_react.c
|
719
|
+
- tracks/c/exercises/react/test/vendor/unity.c
|
720
|
+
- tracks/c/exercises/react/test/vendor/unity.h
|
721
|
+
- tracks/c/exercises/react/test/vendor/unity_internals.h
|
715
722
|
- tracks/c/exercises/rna-transcription/makefile
|
716
723
|
- tracks/c/exercises/rna-transcription/src/example.c
|
717
724
|
- tracks/c/exercises/rna-transcription/src/example.h
|
@@ -1787,6 +1794,26 @@ files:
|
|
1787
1794
|
- tracks/csharp/exercises/zipper/Zipper.cs
|
1788
1795
|
- tracks/csharp/exercises/zipper/Zipper.csproj
|
1789
1796
|
- tracks/csharp/exercises/zipper/ZipperTest.cs
|
1797
|
+
- tracks/csharp/generators/CanonicalData.cs
|
1798
|
+
- tracks/csharp/generators/CanonicalDataCase.cs
|
1799
|
+
- tracks/csharp/generators/CanonicalDataCaseJsonConverter.cs
|
1800
|
+
- tracks/csharp/generators/CanonicalDataCasesJsonConverter.cs
|
1801
|
+
- tracks/csharp/generators/CanonicalDataParser.cs
|
1802
|
+
- tracks/csharp/generators/ExerciseCollection.cs
|
1803
|
+
- tracks/csharp/generators/Exercises/Exercise.cs
|
1804
|
+
- tracks/csharp/generators/Exercises/LeapExercise.cs
|
1805
|
+
- tracks/csharp/generators/Generators.csproj
|
1806
|
+
- tracks/csharp/generators/Generators.csproj.user
|
1807
|
+
- tracks/csharp/generators/Generators.sln
|
1808
|
+
- tracks/csharp/generators/Program.cs
|
1809
|
+
- tracks/csharp/generators/TestClass.cs
|
1810
|
+
- tracks/csharp/generators/TestClassRenderer.cs
|
1811
|
+
- tracks/csharp/generators/TestMethod.cs
|
1812
|
+
- tracks/csharp/generators/TestMethodNameTransformer.cs
|
1813
|
+
- tracks/csharp/generators/TestMethodRenderer.cs
|
1814
|
+
- tracks/csharp/generators/To.cs
|
1815
|
+
- tracks/csharp/generators/generate.ps1
|
1816
|
+
- tracks/csharp/generators/generate.sh
|
1790
1817
|
- tracks/csharp/img/icon.png
|
1791
1818
|
- tracks/delphi/.git
|
1792
1819
|
- tracks/delphi/.gitignore
|
@@ -1880,6 +1907,9 @@ files:
|
|
1880
1907
|
- tracks/delphi/exercises/rna-transcription/RnaTranscription.dpr
|
1881
1908
|
- tracks/delphi/exercises/rna-transcription/uRnaTranscriptionExample.pas
|
1882
1909
|
- tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas
|
1910
|
+
- tracks/delphi/exercises/roman-numerals/RomanNumerals.dpr
|
1911
|
+
- tracks/delphi/exercises/roman-numerals/uRomanNumeralsExample.pas
|
1912
|
+
- tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas
|
1883
1913
|
- tracks/delphi/exercises/saddle-points/SaddlePoints.dpr
|
1884
1914
|
- tracks/delphi/exercises/saddle-points/uSaddlePointsExample.pas
|
1885
1915
|
- tracks/delphi/exercises/saddle-points/uSaddlePointsTests.pas
|
@@ -2441,9 +2471,15 @@ files:
|
|
2441
2471
|
- tracks/elixir/exercises/phone-number/example.exs
|
2442
2472
|
- tracks/elixir/exercises/phone-number/phone_number.exs
|
2443
2473
|
- tracks/elixir/exercises/phone-number/phone_number_test.exs
|
2474
|
+
- tracks/elixir/exercises/poker/example.exs
|
2475
|
+
- tracks/elixir/exercises/poker/poker.exs
|
2476
|
+
- tracks/elixir/exercises/poker/poker_test.exs
|
2444
2477
|
- tracks/elixir/exercises/prime-factors/example.exs
|
2445
2478
|
- tracks/elixir/exercises/prime-factors/prime_factors.exs
|
2446
2479
|
- tracks/elixir/exercises/prime-factors/prime_factors_test.exs
|
2480
|
+
- tracks/elixir/exercises/protein-translation/example.exs
|
2481
|
+
- tracks/elixir/exercises/protein-translation/protein_translation.exs
|
2482
|
+
- tracks/elixir/exercises/protein-translation/protein_translation_test.exs
|
2447
2483
|
- tracks/elixir/exercises/pythagorean-triplet/example.exs
|
2448
2484
|
- tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet.exs
|
2449
2485
|
- tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
|
@@ -2474,6 +2510,9 @@ files:
|
|
2474
2510
|
- tracks/elixir/exercises/saddle-points/example.exs
|
2475
2511
|
- tracks/elixir/exercises/saddle-points/saddle_points.exs
|
2476
2512
|
- tracks/elixir/exercises/saddle-points/saddle_points_test.exs
|
2513
|
+
- tracks/elixir/exercises/say/example.exs
|
2514
|
+
- tracks/elixir/exercises/say/say.exs
|
2515
|
+
- tracks/elixir/exercises/say/say_test.exs
|
2477
2516
|
- tracks/elixir/exercises/scrabble-score/example.exs
|
2478
2517
|
- tracks/elixir/exercises/scrabble-score/scrabble.exs
|
2479
2518
|
- tracks/elixir/exercises/scrabble-score/scrabble_score_test.exs
|
@@ -6098,6 +6137,8 @@ files:
|
|
6098
6137
|
- tracks/php/exercises/etl/example.php
|
6099
6138
|
- tracks/php/exercises/gigasecond/example.php
|
6100
6139
|
- tracks/php/exercises/gigasecond/gigasecond_test.php
|
6140
|
+
- tracks/php/exercises/grade-school/example.php
|
6141
|
+
- tracks/php/exercises/grade-school/grade-school_test.php
|
6101
6142
|
- tracks/php/exercises/grains/example.php
|
6102
6143
|
- tracks/php/exercises/grains/grains_test.php
|
6103
6144
|
- tracks/php/exercises/hamming/example.php
|