trackler 2.0.8.19 → 2.0.8.20

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/phone-number/canonical-data.json +2 -2
  3. data/lib/trackler/version.rb +1 -1
  4. data/tracks/c/config.json +7 -0
  5. data/tracks/c/exercises/react/makefile +16 -0
  6. data/tracks/c/exercises/react/src/example.c +185 -0
  7. data/tracks/c/exercises/react/src/react.h +29 -0
  8. data/tracks/c/exercises/react/test/test_react.c +324 -0
  9. data/tracks/c/exercises/react/test/vendor/unity.c +1300 -0
  10. data/tracks/c/exercises/react/test/vendor/unity.h +274 -0
  11. data/tracks/c/exercises/react/test/vendor/unity_internals.h +701 -0
  12. data/tracks/csharp/.travis.yml +2 -9
  13. data/tracks/csharp/appveyor.yml +3 -3
  14. data/tracks/csharp/build.cake +13 -4
  15. data/tracks/csharp/build.ps1 +56 -164
  16. data/tracks/csharp/build.sh +33 -78
  17. data/tracks/csharp/circle.yml +2 -4
  18. data/tracks/csharp/config.json +2 -1
  19. data/tracks/csharp/exercises/leap/LeapTest.cs +8 -8
  20. data/tracks/csharp/generators/CanonicalData.cs +19 -0
  21. data/tracks/csharp/generators/CanonicalDataCase.cs +24 -0
  22. data/tracks/csharp/generators/CanonicalDataCaseJsonConverter.cs +32 -0
  23. data/tracks/csharp/generators/CanonicalDataCasesJsonConverter.cs +30 -0
  24. data/tracks/csharp/generators/CanonicalDataParser.cs +28 -0
  25. data/tracks/csharp/generators/ExerciseCollection.cs +23 -0
  26. data/tracks/csharp/generators/Exercises/Exercise.cs +14 -0
  27. data/tracks/csharp/generators/Exercises/LeapExercise.cs +35 -0
  28. data/tracks/csharp/generators/Generators.csproj +12 -0
  29. data/tracks/csharp/generators/Generators.csproj.user +6 -0
  30. data/tracks/csharp/generators/Generators.sln +22 -0
  31. data/tracks/csharp/generators/Program.cs +59 -0
  32. data/tracks/csharp/generators/TestClass.cs +13 -0
  33. data/tracks/csharp/generators/TestClassRenderer.cs +36 -0
  34. data/tracks/csharp/generators/TestMethod.cs +9 -0
  35. data/tracks/csharp/generators/TestMethodNameTransformer.cs +11 -0
  36. data/tracks/csharp/generators/TestMethodRenderer.cs +18 -0
  37. data/tracks/csharp/generators/To.cs +7 -0
  38. data/tracks/csharp/generators/generate.ps1 +2 -0
  39. data/tracks/csharp/generators/generate.sh +4 -0
  40. data/tracks/delphi/config.json +8 -0
  41. data/tracks/delphi/exercises/phone-number/uPhoneNumberExample.pas +6 -6
  42. data/tracks/delphi/exercises/phone-number/uPhoneNumberTests.pas +28 -17
  43. data/tracks/delphi/exercises/roman-numerals/RomanNumerals.dpr +60 -0
  44. data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsExample.pas +49 -0
  45. data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +216 -0
  46. data/tracks/elixir/config.json +22 -0
  47. data/tracks/elixir/exercises/poker/example.exs +136 -0
  48. data/tracks/elixir/exercises/poker/poker.exs +34 -0
  49. data/tracks/elixir/exercises/poker/poker_test.exs +217 -0
  50. data/tracks/elixir/exercises/protein-translation/example.exs +62 -0
  51. data/tracks/elixir/exercises/protein-translation/protein_translation.exs +34 -0
  52. data/tracks/elixir/exercises/protein-translation/protein_translation_test.exs +87 -0
  53. data/tracks/elixir/exercises/say/example.exs +139 -0
  54. data/tracks/elixir/exercises/say/say.exs +8 -0
  55. data/tracks/elixir/exercises/say/say_test.exs +85 -0
  56. data/tracks/go/exercises/robot-name/example.go +2 -0
  57. data/tracks/go/exercises/robot-name/robot_name_test.go +9 -1
  58. data/tracks/go/exercises/roman-numerals/roman_numerals_test.go +4 -1
  59. data/tracks/go/exercises/saddle-points/saddle_points_test.go +6 -6
  60. data/tracks/php/config.json +7 -0
  61. data/tracks/php/exercises/grade-school/example.php +35 -0
  62. data/tracks/php/exercises/grade-school/grade-school_test.php +84 -0
  63. metadata +43 -2
@@ -0,0 +1,18 @@
1
+ namespace Generators
2
+ {
3
+ public static class TestMethodRenderer
4
+ {
5
+ private const string TestMethodTemplate =
6
+ @" [Fact{Skip}]
7
+ public void {Name}()
8
+ {
9
+ {Body}
10
+ }";
11
+
12
+ public static string Render(TestMethod testMethod) =>
13
+ TestMethodTemplate
14
+ .Replace("{Name}", testMethod.MethodName)
15
+ .Replace("{Body}", testMethod.Body)
16
+ .Replace("{Skip}", testMethod.Index == 0 ? "" : "(Skip = \"Remove to run test\")");
17
+ }
18
+ }
@@ -0,0 +1,7 @@
1
+ namespace Generators
2
+ {
3
+ public static class To
4
+ {
5
+ public static readonly TestMethodNameTransformer TestMethodName = new TestMethodNameTransformer();
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ Invoke-Expression "dotnet restore"
2
+ Invoke-Expression "dotnet run"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ exec dotnet restore
4
+ exec dotnet run
@@ -164,6 +164,14 @@
164
164
  "Transforming"
165
165
  ]
166
166
  },
167
+ {
168
+ "slug": "roman-numerals",
169
+ "difficulty": 5,
170
+ "topics": [
171
+ "Control-flow (loops)",
172
+ "Record Helpers"
173
+ ]
174
+ },
167
175
  {
168
176
  "slug": "bowling",
169
177
  "difficulty": 6,
@@ -5,10 +5,10 @@ interface
5
5
  type
6
6
  IPhoneNumber = interface(IInvokable)
7
7
  ['{2415B863-E2D7-4E13-BDEF-F7FE9B3E0788}']
8
- function GetNumber: string;
8
+ function GetCleanNumber: string;
9
9
  function GetAreaCode: string;
10
10
  function ToString: string;
11
- property Number: string read GetNumber;
11
+ property Clean: string read GetCleanNumber;
12
12
  property AreaCode: string read GetAreaCode;
13
13
  end;
14
14
 
@@ -24,7 +24,7 @@ type
24
24
  fContainsLetters: TRegex;
25
25
  fNumber: string;
26
26
  fAreaCode: string;
27
- function GetNumber: string;
27
+ function GetCleanNumber: string;
28
28
  function GetAreaCode: string;
29
29
  function GetValidatedPhoneNumber(aPhoneNumber: string): string;
30
30
  function StripOutNonNumerics(aValue: string): string;
@@ -34,7 +34,7 @@ type
34
34
  public
35
35
  constructor Create(aPhoneNumber: string);
36
36
  function ToString: string;
37
- property Number: string read GetNumber;
37
+ property Clean: string read GetCleanNumber;
38
38
  property AreaCode: string read GetAreaCode;
39
39
  end;
40
40
 
@@ -51,7 +51,7 @@ begin
51
51
  fAreaCode := fNumber.Substring(0, 3);
52
52
  end;
53
53
 
54
- function TPhoneNumber.GetNumber: string;
54
+ function TPhoneNumber.GetCleanNumber: string;
55
55
  begin
56
56
  result := fNumber;
57
57
  end;
@@ -96,7 +96,7 @@ end;
96
96
 
97
97
  function TPhoneNumber.ToString: string;
98
98
  begin
99
- result := Format('(%s) %s-%s',[AreaCode, Number.Substring(3, 3), Number.Substring(6)]);
99
+ result := Format('(%s) %s-%s',[AreaCode, Clean.Substring(3, 3), Clean.Substring(6)]);
100
100
  end;
101
101
 
102
102
  end.
@@ -17,27 +17,31 @@ type
17
17
  public
18
18
  [Test]
19
19
  // [Ignore('Comment the "[Ignore]" statement to run the test')]
20
- procedure Cleans_parens_spaces_and_dashes;
20
+ procedure Cleans_the_number;
21
21
 
22
22
  [Test]
23
23
  [Ignore]
24
24
  procedure Cleans_numbers_with_dots;
25
25
 
26
+ [Test]
27
+ [Ignore]
28
+ procedure Cleans_numbers_with_multiple_spaces;
29
+
26
30
  [Test]
27
31
  [Ignore]
28
32
  procedure Valid_when_11_digits_and_starting_with_1;
29
33
 
30
34
  [Test]
31
35
  [Ignore]
32
- procedure Invalid_when_11_digits;
36
+ procedure Invalid_when_9_digits;
33
37
 
34
38
  [Test]
35
39
  [Ignore]
36
- procedure Invalid_when_12_digits;
40
+ procedure Invalid_when_11_digits_does_not_start_with_a_1;
37
41
 
38
42
  [Test]
39
43
  [Ignore]
40
- procedure Invalid_when_9_digits;
44
+ procedure Invalid_when_more_than_11_digits;
41
45
 
42
46
  [Test]
43
47
  [Ignore]
@@ -52,7 +56,7 @@ type
52
56
  procedure Invalid_with_right_number_of_digits_but_letters_mixed_in;
53
57
 
54
58
  [Test]
55
- [Ignore]
59
+ [Ignore('This is a bonus test')]
56
60
  procedure Has_an_area_code;
57
61
 
58
62
  [Test]
@@ -63,67 +67,74 @@ type
63
67
  implementation
64
68
  uses uPhoneNumber;
65
69
 
66
- procedure PhoneNumberTests.Cleans_parens_spaces_and_dashes;
70
+ procedure PhoneNumberTests.Cleans_the_number;
67
71
  var phone: IPhoneNumber;
68
72
  begin
69
73
  phone := NewPhoneNumber('(123) 456-7890');
70
- assert.AreEqual('1234567890',phone.Number);
74
+ assert.AreEqual('1234567890',phone.Clean);
71
75
  end;
72
76
 
73
77
  procedure PhoneNumberTests.Cleans_numbers_with_dots;
74
78
  var phone: IPhoneNumber;
75
79
  begin
76
80
  phone := NewPhoneNumber('123.456.7890');
77
- assert.AreEqual('1234567890',phone.Number);
81
+ assert.AreEqual('1234567890',phone.Clean);
82
+ end;
83
+
84
+ procedure PhoneNumberTests.Cleans_numbers_with_multiple_spaces;
85
+ var phone: IPhoneNumber;
86
+ begin
87
+ phone := NewPhoneNumber('123 456 7890 ');
88
+ assert.AreEqual('1234567890',phone.Clean);
78
89
  end;
79
90
 
80
91
  procedure PhoneNumberTests.Valid_when_11_digits_and_starting_with_1;
81
92
  var phone: IPhoneNumber;
82
93
  begin
83
94
  phone := NewPhoneNumber('11234567890');
84
- assert.AreEqual('1234567890', phone.Number);
95
+ assert.AreEqual('1234567890', phone.Clean);
85
96
  end;
86
97
 
87
- procedure PhoneNumberTests.Invalid_when_11_digits;
98
+ procedure PhoneNumberTests.Invalid_when_11_digits_does_not_start_with_a_1;
88
99
  var phone: IPhoneNumber;
89
100
  begin
90
101
  phone := NewPhoneNumber('21234567890');
91
- assert.AreEqual('', phone.Number);
102
+ assert.AreEqual('', phone.Clean);
92
103
  end;
93
104
 
94
- procedure PhoneNumberTests.Invalid_when_12_digits;
105
+ procedure PhoneNumberTests.Invalid_when_more_than_11_digits;
95
106
  var phone: IPhoneNumber;
96
107
  begin
97
108
  phone := NewPhoneNumber('321234567890');
98
- assert.AreEqual('', phone.Number);
109
+ assert.AreEqual('', phone.Clean);
99
110
  end;
100
111
 
101
112
  procedure PhoneNumberTests.Invalid_when_9_digits;
102
113
  var phone: IPhoneNumber;
103
114
  begin
104
115
  phone := NewPhoneNumber('123456789');
105
- assert.AreEqual('', phone.Number);
116
+ assert.AreEqual('', phone.Clean);
106
117
  end;
107
118
 
108
119
  procedure PhoneNumberTests.Invalid_with_letters;
109
120
  var phone: IPhoneNumber;
110
121
  begin
111
122
  phone := NewPhoneNumber('123-abc-7890');
112
- assert.AreEqual('', phone.Number);
123
+ assert.AreEqual('', phone.Clean);
113
124
  end;
114
125
 
115
126
  procedure PhoneNumberTests.Invalid_with_punctuations;
116
127
  var phone: IPhoneNumber;
117
128
  begin
118
129
  phone := NewPhoneNumber('123-@:!-7890');
119
- assert.AreEqual('', phone.Number);
130
+ assert.AreEqual('', phone.Clean);
120
131
  end;
121
132
 
122
133
  procedure PhoneNumberTests.Invalid_with_right_number_of_digits_but_letters_mixed_in;
123
134
  var phone: IPhoneNumber;
124
135
  begin
125
136
  phone := NewPhoneNumber('1a2b3c4d5e6f7g8h9i0j');
126
- assert.AreEqual('', phone.Number);
137
+ assert.AreEqual('', phone.Clean);
127
138
  end;
128
139
 
129
140
  procedure PhoneNumberTests.Has_an_area_code;
@@ -0,0 +1,60 @@
1
+ program RomanNumerals;
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
+ uRomanNumeralsTest in 'uRomanNumeralsTest.pas',
15
+ uRomanNumerals in 'uRomanNumerals.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,49 @@
1
+ unit uRomanNumerals;
2
+
3
+ interface
4
+
5
+ type
6
+ RomanNumeralHelper = record helper for integer
7
+ public
8
+ function ToRoman: string;
9
+ end;
10
+
11
+ implementation
12
+ uses System.Generics.Collections;
13
+
14
+ function RomanNumeralHelper.ToRoman: string;
15
+ var ArabicToRomanConversions: TList<TPair<integer, string>>;
16
+ conversion: TPair<integer, string>;
17
+ lInt: integer;
18
+ begin
19
+ result := '';
20
+ lInt := self;
21
+ ArabicToRomanConversions := TList<TPair<integer, string>>.create;
22
+ with ArabicToRomanConversions do
23
+ begin
24
+ Add(TPair<integer, string>.Create(1000, 'M'));
25
+ Add(TPair<integer, string>.Create(900, 'CM'));
26
+ Add(TPair<integer, string>.Create(500, 'D'));
27
+ Add(TPair<integer, string>.Create(400, 'CD'));
28
+ Add(TPair<integer, string>.Create(100, 'C'));
29
+ Add(TPair<integer, string>.Create(90, 'XC'));
30
+ Add(TPair<integer, string>.Create(50, 'L'));
31
+ Add(TPair<integer, string>.Create(40, 'XL'));
32
+ Add(TPair<integer, string>.Create(10, 'X'));
33
+ Add(TPair<integer, string>.Create(9, 'IX'));
34
+ Add(TPair<integer, string>.Create(5, 'V'));
35
+ Add(TPair<integer, string>.Create(4, 'IV'));
36
+ Add(TPair<integer, string>.Create(1, 'I'));
37
+ end;
38
+
39
+ for conversion in ArabicToRomanConversions do
40
+ begin
41
+ while (lInt div conversion.Key) > 0 do
42
+ begin
43
+ lInt := lInt - conversion.Key;
44
+ result := result + conversion.Value;
45
+ end;
46
+ end;
47
+ end;
48
+
49
+ end.
@@ -0,0 +1,216 @@
1
+ unit uRomanNumeralsTest;
2
+
3
+ interface
4
+ uses
5
+ DUnitX.TestFramework;
6
+
7
+ type
8
+
9
+ [TestFixture]
10
+ RomanNumeralsTest = class(TObject)
11
+ public
12
+ [Test]
13
+ // [Ignore('Comment the "[Ignore]" statement to run the test')]
14
+ procedure One_is_a_single_I;
15
+
16
+ [Test]
17
+ [Ignore]
18
+ procedure Two_is_two_I_s;
19
+
20
+ [Test]
21
+ [Ignore]
22
+ procedure Three_is_three_I_s;
23
+
24
+ [Test]
25
+ [Ignore]
26
+ procedure Four_being_5_minus_1_is_IV;
27
+
28
+ [Test]
29
+ [Ignore]
30
+ procedure Five_is_a_single_V;
31
+
32
+ [Test]
33
+ [Ignore]
34
+ procedure Six_being_5_plus_1_is_VI;
35
+
36
+ [Test]
37
+ [Ignore]
38
+ procedure Nine_being_10_minus_1_is_IX;
39
+
40
+ [Test]
41
+ [Ignore]
42
+ procedure Twenty_is_two_X_s;
43
+
44
+ [Test]
45
+ [Ignore]
46
+ procedure Fourty_eight_is_not_50_minus_2_but_rather_40_plus_8;
47
+
48
+ [Test]
49
+ [Ignore]
50
+ procedure Fifty_is_a_single_L;
51
+
52
+ [Test]
53
+ [Ignore]
54
+ procedure Ninety_being_100_minus_10_is_XC;
55
+
56
+ [Test]
57
+ [Ignore]
58
+ procedure One_hundred_is_a_single_C;
59
+
60
+ [Test]
61
+ [Ignore]
62
+ procedure Sixety_being_50_plus_10_is_LX;
63
+
64
+ [Test]
65
+ [Ignore]
66
+ procedure Four_hundred_being_500_minus_100_is_CD;
67
+
68
+ [Test]
69
+ [Ignore]
70
+ procedure Five_hundred_is_a_single_D;
71
+
72
+ [Test]
73
+ [Ignore]
74
+ procedure Nine_hundred_being_1000_minus_100_is_CM;
75
+
76
+ [Test]
77
+ [Ignore]
78
+ procedure One_thousand_is_a_single_M;
79
+
80
+ [Test]
81
+ [Ignore]
82
+ procedure Three_thousand_is_three_M_s;
83
+ end;
84
+
85
+ implementation
86
+ uses uRomanNumerals;
87
+
88
+ procedure RomanNumeralsTest.One_is_a_single_I;
89
+ var arabicNumeral: integer;
90
+ begin
91
+ arabicNumeral := 1;
92
+ Assert.AreEqual('I', arabicNumeral.ToRoman);
93
+ end;
94
+
95
+ procedure RomanNumeralsTest.Two_is_two_I_s;
96
+ var arabicNumeral: integer;
97
+ begin
98
+ arabicNumeral := 2;
99
+ Assert.AreEqual('II', arabicNumeral.ToRoman);
100
+ end;
101
+
102
+ procedure RomanNumeralsTest.Three_is_three_I_s;
103
+ var arabicNumeral: integer;
104
+ begin
105
+ arabicNumeral := 3;
106
+ Assert.AreEqual('III', arabicNumeral.ToRoman);
107
+ end;
108
+
109
+ procedure RomanNumeralsTest.Four_being_5_minus_1_is_IV;
110
+ var arabicNumeral: integer;
111
+ begin
112
+ arabicNumeral := 4;
113
+ Assert.AreEqual('IV', arabicNumeral.ToRoman);
114
+ end;
115
+
116
+ procedure RomanNumeralsTest.Five_is_a_single_V;
117
+ var arabicNumeral: integer;
118
+ begin
119
+ arabicNumeral := 5;
120
+ Assert.AreEqual('V', arabicNumeral.ToRoman);
121
+ end;
122
+
123
+ procedure RomanNumeralsTest.Six_being_5_plus_1_is_VI;
124
+ var arabicNumeral: integer;
125
+ begin
126
+ arabicNumeral := 6;
127
+ Assert.AreEqual('VI', arabicNumeral.ToRoman);
128
+ end;
129
+
130
+ procedure RomanNumeralsTest.Nine_being_10_minus_1_is_IX;
131
+ var arabicNumeral: integer;
132
+ begin
133
+ arabicNumeral := 9;
134
+ Assert.AreEqual('IX', arabicNumeral.ToRoman);
135
+ end;
136
+
137
+ procedure RomanNumeralsTest.Twenty_is_two_X_s;
138
+ var arabicNumeral: integer;
139
+ begin
140
+ arabicNumeral := 20;
141
+ Assert.AreEqual('XX', arabicNumeral.ToRoman);
142
+ end;
143
+
144
+ procedure RomanNumeralsTest.Fourty_eight_is_not_50_minus_2_but_rather_40_plus_8;
145
+ var arabicNumeral: integer;
146
+ begin
147
+ arabicNumeral := 48;
148
+ Assert.AreEqual('XLVIII', arabicNumeral.ToRoman);
149
+ end;
150
+
151
+ procedure RomanNumeralsTest.Fifty_is_a_single_L;
152
+ var arabicNumeral: integer;
153
+ begin
154
+ arabicNumeral := 50;
155
+ Assert.AreEqual('L', arabicNumeral.ToRoman);
156
+ end;
157
+
158
+ procedure RomanNumeralsTest.Ninety_being_100_minus_10_is_XC;
159
+ var arabicNumeral: integer;
160
+ begin
161
+ arabicNumeral := 90;
162
+ Assert.AreEqual('XC', arabicNumeral.ToRoman);
163
+ end;
164
+
165
+ procedure RomanNumeralsTest.One_hundred_is_a_single_C;
166
+ var arabicNumeral: integer;
167
+ begin
168
+ arabicNumeral := 100;
169
+ Assert.AreEqual('C', arabicNumeral.ToRoman);
170
+ end;
171
+
172
+ procedure RomanNumeralsTest.Sixety_being_50_plus_10_is_LX;
173
+ var arabicNumeral: integer;
174
+ begin
175
+ arabicNumeral := 60;
176
+ Assert.AreEqual('LX', arabicNumeral.ToRoman);
177
+ end;
178
+
179
+ procedure RomanNumeralsTest.Four_hundred_being_500_minus_100_is_CD;
180
+ var arabicNumeral: integer;
181
+ begin
182
+ arabicNumeral := 400;
183
+ Assert.AreEqual('CD', arabicNumeral.ToRoman);
184
+ end;
185
+
186
+ procedure RomanNumeralsTest.Five_hundred_is_a_single_D;
187
+ var arabicNumeral: integer;
188
+ begin
189
+ arabicNumeral := 500;
190
+ Assert.AreEqual('D', arabicNumeral.ToRoman);
191
+ end;
192
+
193
+ procedure RomanNumeralsTest.Nine_hundred_being_1000_minus_100_is_CM;
194
+ var arabicNumeral: integer;
195
+ begin
196
+ arabicNumeral := 900;
197
+ Assert.AreEqual('CM', arabicNumeral.ToRoman);
198
+ end;
199
+
200
+ procedure RomanNumeralsTest.One_thousand_is_a_single_M;
201
+ var arabicNumeral: integer;
202
+ begin
203
+ arabicNumeral := 1000;
204
+ Assert.AreEqual('M', arabicNumeral.ToRoman);
205
+ end;
206
+
207
+ procedure RomanNumeralsTest.Three_thousand_is_three_M_s;
208
+ var arabicNumeral: integer;
209
+ begin
210
+ arabicNumeral := 3000;
211
+ Assert.AreEqual('MMM', arabicNumeral.ToRoman);
212
+ end;
213
+
214
+ initialization
215
+ TDUnitX.RegisterTestFixture(RomanNumeralsTest);
216
+ end.