trackler 2.2.1.72 → 2.2.1.73
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/armstrong-numbers/canonical-data.json +70 -0
- data/problem-specifications/exercises/armstrong-numbers/description.md +10 -0
- data/problem-specifications/exercises/armstrong-numbers/metadata.yml +4 -0
- data/problem-specifications/exercises/bob/canonical-data.json +2 -2
- data/problem-specifications/exercises/bob/description.md +2 -0
- data/tracks/c/config.json +41 -41
- data/tracks/common-lisp/exercises/etl/README.md +1 -1
- data/tracks/common-lisp/exercises/isogram/README.md +1 -1
- data/tracks/delphi/config.json +10 -0
- data/tracks/delphi/config/maintainers.json +2 -2
- data/tracks/delphi/exercises/armstrong-numbers/ArmstrongNumbers.dpr +60 -0
- data/tracks/delphi/exercises/armstrong-numbers/README.md +39 -0
- data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersExample.pas +24 -0
- data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersTests.pas +101 -0
- data/tracks/delphi/exercises/bob/README.md +2 -0
- data/tracks/delphi/exercises/bob/uBobExample.pas +12 -3
- data/tracks/delphi/exercises/bob/uBobTests.pas +80 -23
- data/tracks/go/exercises/bob/README.md +2 -0
- data/tracks/go/exercises/bob/cases_test.go +3 -3
- data/tracks/go/exercises/bob/example.go +3 -0
- data/tracks/go/exercises/book-store/cases_test.go +7 -2
- data/tracks/go/exercises/word-count/cases_test.go +6 -1
- data/tracks/groovy/exercises/linked-list/README.md +1 -1
- data/tracks/haskell/.travis.yml +1 -0
- data/tracks/haskell/bin/ensure-readmes-are-updated.sh +40 -0
- data/tracks/haskell/config.json +9 -0
- data/tracks/haskell/exercises/rail-fence-cipher/README.md +119 -0
- data/tracks/haskell/exercises/rail-fence-cipher/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/rail-fence-cipher/examples/success-standard/src/RailFenceCipher.hs +12 -0
- data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +20 -0
- data/tracks/haskell/exercises/rail-fence-cipher/src/RailFenceCipher.hs +7 -0
- data/tracks/haskell/exercises/rail-fence-cipher/stack.yaml +1 -0
- data/tracks/haskell/exercises/rail-fence-cipher/test/Tests.hs +60 -0
- data/tracks/java/CONTRIBUTING.md +14 -5
- data/tracks/java/bin/run-journey-test-from-ci.sh +1 -1
- data/tracks/java/config.json +13 -0
- data/tracks/java/exercises/custom-set/.meta/src/reference/java/CustomSet.java +12 -12
- data/tracks/java/exercises/food-chain/.meta/src/reference/java/FoodChain.java +3 -3
- data/tracks/java/exercises/grade-school/.meta/src/reference/java/School.java +7 -7
- data/tracks/java/exercises/hamming/.meta/src/reference/java/Hamming.java +3 -3
- data/tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java +2 -4
- data/tracks/java/exercises/isogram/.meta/src/reference/java/IsogramChecker.java +2 -2
- data/tracks/java/exercises/largest-series-product/.meta/src/reference/java/LargestSeriesProductCalculator.java +3 -3
- data/tracks/java/exercises/linked-list/.meta/src/reference/java/DoublyLinkedList.java +6 -6
- data/tracks/java/exercises/markdown/.meta/src/reference/java/Markdown.java +96 -0
- data/tracks/java/exercises/markdown/.meta/version +1 -0
- data/tracks/java/exercises/markdown/README.md +30 -0
- data/tracks/java/exercises/markdown/build.gradle +18 -0
- data/tracks/java/exercises/markdown/src/main/java/Markdown.java +83 -0
- data/tracks/java/exercises/markdown/src/test/java/MarkdownTest.java +95 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/exercises/alphametics/example.js +13 -9
- data/tracks/kotlin/docs/TESTS.md +14 -11
- data/tracks/ocaml/exercises/bob/example.ml +5 -3
- data/tracks/ocaml/exercises/bob/test.ml +3 -4
- data/tracks/ocaml/exercises/word-count/test.ml +3 -0
- data/tracks/ocaml/tools/test-generator/templates/ocaml/bob/test.ml +0 -1
- data/tracks/perl6/config.json +16 -6
- data/tracks/perl6/exercises/bob/Bob.pm6 +1 -1
- data/tracks/perl6/exercises/bob/Example.pm6 +11 -7
- data/tracks/perl6/exercises/bob/README.md +2 -0
- data/tracks/perl6/exercises/bob/bob.t +3 -3
- data/tracks/perl6/exercises/bob/example.yaml +11 -7
- data/tracks/perl6/exercises/clock/clock.t +17 -17
- data/tracks/perl6/exercises/clock/example.yaml +17 -17
- data/tracks/perl6/exercises/roman-numerals/Example.pm6 +17 -0
- data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +4 -0
- data/tracks/perl6/exercises/roman-numerals/example.yaml +30 -0
- data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +162 -0
- data/tracks/python/exercises/book-store/book_store_test.py +7 -1
- data/tracks/ruby/config.json +11 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/.version +1 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb +28 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/solutions/isbn_verifier.rb +25 -0
- data/tracks/ruby/exercises/isbn-verifier/README.md +73 -0
- data/tracks/ruby/exercises/isbn-verifier/isbn_verifier_test.rb +105 -0
- data/tracks/ruby/exercises/isogram/.meta/generator/isogram_case.rb +3 -3
- data/tracks/ruby/exercises/isogram/isogram_test.rb +18 -18
- data/tracks/rust/README.md +0 -2
- data/tracks/rust/config.json +11 -0
- data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +0 -1
- data/tracks/rust/exercises/parallel-letter-frequency/HINTS.md +2 -2
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +2 -2
- data/tracks/rust/exercises/rna-transcription/example.rs +10 -10
- data/tracks/rust/exercises/rna-transcription/tests/rna-transcription.rs +10 -10
- data/tracks/rust/exercises/series/.gitignore +3 -0
- data/tracks/rust/exercises/series/Cargo.toml +5 -0
- data/tracks/rust/exercises/series/README.md +60 -0
- data/tracks/rust/exercises/series/example.rs +13 -0
- data/tracks/rust/exercises/series/src/lib.rs +3 -0
- data/tracks/rust/exercises/series/tests/series.rs +34 -0
- data/tracks/sml/exercises/nth-prime/README.md +1 -1
- data/tracks/vimscript/.travis.yml +3 -0
- data/tracks/vimscript/docs/LEARNING.md +1 -1
- metadata +38 -2
@@ -48,7 +48,7 @@ game while being scored at 4 in the Hawaiian-language version.
|
|
48
48
|
|
49
49
|
## Setup
|
50
50
|
|
51
|
-
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
51
|
+
Check out [Exercism Help](http://exercism.io/languages/common-lisp) for instructions to
|
52
52
|
get started writing Common Lisp. That page will explain how to install and setup
|
53
53
|
a Lisp implementation and how to run the tests.
|
54
54
|
|
@@ -59,7 +59,7 @@ with the REPL; making iterative coding and testing very easy.
|
|
59
59
|
|
60
60
|
## Source
|
61
61
|
|
62
|
-
Learn more about Isograms at [wikipedia](https://en.wikipedia.org/wiki/Isogram
|
62
|
+
Learn more about Isograms at [wikipedia](https://en.wikipedia.org/wiki/Isogram)
|
63
63
|
|
64
64
|
## Submitting Incomplete Solutions
|
65
65
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
data/tracks/delphi/config.json
CHANGED
@@ -140,6 +140,16 @@
|
|
140
140
|
"unlocked_by": null,
|
141
141
|
"uuid": "edfc2903-1165-4029-9901-0be72b32865f"
|
142
142
|
},
|
143
|
+
{
|
144
|
+
"core": false,
|
145
|
+
"difficulty": 2,
|
146
|
+
"slug": "armstrong-numbers",
|
147
|
+
"topics": [
|
148
|
+
"algorithms"
|
149
|
+
],
|
150
|
+
"unlocked_by": "collatz-conjecture",
|
151
|
+
"uuid": "5315f8b0-f2a2-4750-8dc3-b4d182111036"
|
152
|
+
},
|
143
153
|
{
|
144
154
|
"core": false,
|
145
155
|
"difficulty": 3,
|
@@ -14,7 +14,7 @@
|
|
14
14
|
{
|
15
15
|
"alumnus": false,
|
16
16
|
"avatar_url": null,
|
17
|
-
"bio": "I have been using Delphi professionally since 1996. At my day job I develop software used in the control of various types of test machines used by the auto industry. Exercism is my first real push into Open Source and I'm happy to have this opportunity to teach and share the
|
17
|
+
"bio": "I have been using Delphi professionally since 1996. At my day job I develop software used in the control of various types of test machines used by the auto industry. Exercism is my first real push into Open Source and I'm happy to have this opportunity to teach and share the virtues of Delphi with others.",
|
18
18
|
"github_username": "rpottsoh",
|
19
19
|
"link_text": null,
|
20
20
|
"link_url": null,
|
@@ -22,4 +22,4 @@
|
|
22
22
|
"show_on_website": true
|
23
23
|
}
|
24
24
|
]
|
25
|
-
}
|
25
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
program ArmstrongNumbers;
|
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
|
+
uArmstrongNumbersTests in 'uArmstrongNumbersTests.pas',
|
15
|
+
uArmstrongNumbers in 'uArmstrongNumbers.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,39 @@
|
|
1
|
+
# Armstrong Numbers
|
2
|
+
|
3
|
+
An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
|
4
|
+
|
5
|
+
For example:
|
6
|
+
|
7
|
+
- 9 is an Armstrong number, because `9 = 9^1 = 9`
|
8
|
+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
|
9
|
+
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
|
10
|
+
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
|
11
|
+
|
12
|
+
Write some code to determine whether a number is an Armstrong number.
|
13
|
+
|
14
|
+
## Testing
|
15
|
+
|
16
|
+
In order to run the tests for this track, you will need to install
|
17
|
+
DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
|
18
|
+
|
19
|
+
### Loading Exercises into Delphi
|
20
|
+
|
21
|
+
If Delphi is properly installed, and `*.dpr` file types have been associated with Delphi, then double clicking the supplied `*.dpr` file will start Delphi and load the exercise/project. `control + F9` is the keyboard shortcut to compile the project or pressing `F9` will compile and run the project.
|
22
|
+
|
23
|
+
Alternatively you may opt to start Delphi and load your project via. the `File` drop down menu.
|
24
|
+
|
25
|
+
### When Questions Come Up
|
26
|
+
We monitor the [Pascal-Delphi](https://gitter.im/exercism/Pascal-Delphi) support room on [gitter.im](https://gitter.im) to help you with any questions that might arise.
|
27
|
+
|
28
|
+
### Submitting Exercises
|
29
|
+
|
30
|
+
Note that, when trying to submit an exercise, make sure the exercise file you're submitting is in the `exercism/delphi/<exerciseName>` directory.
|
31
|
+
|
32
|
+
For example, if you're submitting `ubob.pas` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/delphi/bob/ubob.pas`.
|
33
|
+
|
34
|
+
## Source
|
35
|
+
|
36
|
+
Wikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number)
|
37
|
+
|
38
|
+
## Submitting Incomplete Solutions
|
39
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
unit uArmstrongNumbers;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses System.SysUtils, System.Math;
|
5
|
+
|
6
|
+
function isArmstrongNumber(aNumber: integer): Boolean;
|
7
|
+
|
8
|
+
implementation
|
9
|
+
|
10
|
+
function isArmstrongNumber(aNumber: integer): Boolean;
|
11
|
+
var wrkString: string;
|
12
|
+
Exponent: integer;
|
13
|
+
wrkInteger: integer;
|
14
|
+
i: integer;
|
15
|
+
begin
|
16
|
+
wrkString := aNumber.ToString;
|
17
|
+
Exponent := length(wrkString);
|
18
|
+
wrkInteger := 0;
|
19
|
+
for i := low(wrkString) to high(wrkString) do
|
20
|
+
wrkInteger := wrkInteger + trunc(Power(string.ToInteger(wrkString[i]), Exponent));
|
21
|
+
result := wrkInteger = aNumber;
|
22
|
+
end;
|
23
|
+
|
24
|
+
end.
|
@@ -0,0 +1,101 @@
|
|
1
|
+
unit uArmstrongNumbersTests;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses
|
5
|
+
DUnitX.TestFramework;
|
6
|
+
|
7
|
+
const
|
8
|
+
CanonicalVersion = '1.0.0';
|
9
|
+
|
10
|
+
type
|
11
|
+
|
12
|
+
[TestFixture]
|
13
|
+
ArmstrongNumbersTests = class(TObject)
|
14
|
+
public
|
15
|
+
[Test]
|
16
|
+
// [Ignore('Comment the "[Ignore]" statement to run the test')]
|
17
|
+
procedure Single_digit_numbers_are_Armstrong_numbers;
|
18
|
+
|
19
|
+
[Test]
|
20
|
+
[Ignore]
|
21
|
+
procedure There_are_no_2_digit_Armstrong_numbers;
|
22
|
+
|
23
|
+
[Test]
|
24
|
+
[Ignore]
|
25
|
+
procedure Three_digit_number_that_is_an_Armstrong_number;
|
26
|
+
|
27
|
+
[Test]
|
28
|
+
[Ignore]
|
29
|
+
procedure Three_digit_number_that_is_not_an_Armstrong_number;
|
30
|
+
|
31
|
+
[Test]
|
32
|
+
[Ignore]
|
33
|
+
procedure Four_digit_number_that_is_an_Armstrong_number;
|
34
|
+
|
35
|
+
[Test]
|
36
|
+
[Ignore]
|
37
|
+
procedure Four_digit_number_that_is_not_an_Armstrong_number;
|
38
|
+
|
39
|
+
[Test]
|
40
|
+
[Ignore]
|
41
|
+
procedure Seven_digit_number_that_is_an_Armstrong_number;
|
42
|
+
|
43
|
+
[Test]
|
44
|
+
[Ignore]
|
45
|
+
procedure Seven_digit_number_that_is_not_an_Armstrong_number;
|
46
|
+
end;
|
47
|
+
|
48
|
+
implementation
|
49
|
+
uses uArmstrongNumbers;
|
50
|
+
|
51
|
+
{ ArmstrongNumbersTests }
|
52
|
+
|
53
|
+
procedure ArmstrongNumbersTests.Four_digit_number_that_is_an_Armstrong_number;
|
54
|
+
begin
|
55
|
+
Assert.IsTrue(isArmstrongNumber(9474));
|
56
|
+
end;
|
57
|
+
|
58
|
+
procedure ArmstrongNumbersTests.Four_digit_number_that_is_not_an_Armstrong_number;
|
59
|
+
begin
|
60
|
+
Assert.IsFalse(isArmstrongNumber(9475));
|
61
|
+
end;
|
62
|
+
|
63
|
+
procedure ArmstrongNumbersTests.Seven_digit_number_that_is_an_Armstrong_number;
|
64
|
+
begin
|
65
|
+
Assert.IsTrue(isArmstrongNumber(9926315));
|
66
|
+
end;
|
67
|
+
|
68
|
+
procedure ArmstrongNumbersTests.Seven_digit_number_that_is_not_an_Armstrong_number;
|
69
|
+
begin
|
70
|
+
Assert.IsFalse(isArmstrongNumber(9926314));
|
71
|
+
end;
|
72
|
+
|
73
|
+
procedure ArmstrongNumbersTests.Single_digit_numbers_are_Armstrong_numbers;
|
74
|
+
var
|
75
|
+
i: integer;
|
76
|
+
begin
|
77
|
+
for i := 0 to 9 do
|
78
|
+
Assert.IsTrue(isArmstrongNumber(i));
|
79
|
+
end;
|
80
|
+
|
81
|
+
procedure ArmstrongNumbersTests.There_are_no_2_digit_Armstrong_numbers;
|
82
|
+
var
|
83
|
+
i: integer;
|
84
|
+
begin
|
85
|
+
for i := 10 to 99 do
|
86
|
+
Assert.IsFalse(isArmstrongNumber(i));
|
87
|
+
end;
|
88
|
+
|
89
|
+
procedure ArmstrongNumbersTests.Three_digit_number_that_is_an_Armstrong_number;
|
90
|
+
begin
|
91
|
+
Assert.IsTrue(isArmstrongNumber(153));
|
92
|
+
end;
|
93
|
+
|
94
|
+
procedure ArmstrongNumbersTests.Three_digit_number_that_is_not_an_Armstrong_number;
|
95
|
+
begin
|
96
|
+
Assert.IsFalse(isArmstrongNumber(100));
|
97
|
+
end;
|
98
|
+
|
99
|
+
initialization
|
100
|
+
TDUnitX.RegisterTestFixture(ArmstrongNumbersTests);
|
101
|
+
end.
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
6
6
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
8
8
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
10
|
+
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
10
12
|
anything.
|
11
13
|
|
@@ -8,8 +8,9 @@ type
|
|
8
8
|
class function IsSilence(aStatement: string): Boolean; static;
|
9
9
|
class function IsYelling(aStatement: string): Boolean; static;
|
10
10
|
class function IsQuestion(aStatement: string): Boolean; static;
|
11
|
+
class function IsYellingQuestion(aStatement: string): Boolean; static;
|
11
12
|
public
|
12
|
-
class function
|
13
|
+
class function Response(aStatement: string): string; static;
|
13
14
|
End;
|
14
15
|
|
15
16
|
implementation
|
@@ -25,16 +26,24 @@ begin
|
|
25
26
|
result := (aStatement.ToUpper = aStatement) and TRegEx.IsMatch(aStatement, '[a-zA-Z]+');
|
26
27
|
end;
|
27
28
|
|
29
|
+
class function TBob.IsYellingQuestion(aStatement: string): Boolean;
|
30
|
+
begin
|
31
|
+
result := IsQuestion(aStatement) and IsYelling(aStatement);
|
32
|
+
end;
|
33
|
+
|
28
34
|
class function TBob.IsQuestion(aStatement: string): Boolean;
|
29
35
|
begin
|
30
36
|
result := aStatement.Trim.EndsWith('?');
|
31
37
|
end;
|
32
38
|
|
33
|
-
class function TBob.
|
39
|
+
class function TBob.Response(aStatement: string): string;
|
34
40
|
begin
|
35
41
|
if IsSilence(aStatement) then
|
36
|
-
result := 'Fine.
|
42
|
+
result := 'Fine. Be that way!'
|
37
43
|
else
|
44
|
+
if IsYellingQuestion(aStatement) then
|
45
|
+
result := 'Calm down, I know what I''m doing!'
|
46
|
+
else
|
38
47
|
if IsYelling(aStatement) then
|
39
48
|
result := 'Whoa, chill out!'
|
40
49
|
else
|
@@ -4,6 +4,9 @@ interface
|
|
4
4
|
uses
|
5
5
|
DUnitX.TestFramework;
|
6
6
|
|
7
|
+
const
|
8
|
+
CanonicalVersion = '1.1.0';
|
9
|
+
|
7
10
|
type
|
8
11
|
|
9
12
|
[TestFixture]
|
@@ -23,11 +26,11 @@ type
|
|
23
26
|
|
24
27
|
[Test]
|
25
28
|
[Ignore]
|
26
|
-
procedure
|
29
|
+
procedure Asking_a_numeric_question;
|
27
30
|
|
28
31
|
[Test]
|
29
32
|
[Ignore]
|
30
|
-
procedure
|
33
|
+
procedure Asking_gibberish;
|
31
34
|
|
32
35
|
[Test]
|
33
36
|
[Ignore]
|
@@ -35,7 +38,7 @@ type
|
|
35
38
|
|
36
39
|
[Test]
|
37
40
|
[Ignore]
|
38
|
-
procedure
|
41
|
+
procedure Using_acronyms_in_regular_speech;
|
39
42
|
|
40
43
|
[Test]
|
41
44
|
[Ignore]
|
@@ -65,6 +68,10 @@ type
|
|
65
68
|
[Ignore]
|
66
69
|
procedure Statement_containing_question_mark;
|
67
70
|
|
71
|
+
[Test]
|
72
|
+
[Ignore]
|
73
|
+
procedure non_letters_with_question;
|
74
|
+
|
68
75
|
[Test]
|
69
76
|
[Ignore]
|
70
77
|
procedure Prattling_on;
|
@@ -77,9 +84,29 @@ type
|
|
77
84
|
[Ignore]
|
78
85
|
procedure Prolonged_silence;
|
79
86
|
|
87
|
+
[Test]
|
88
|
+
[Ignore]
|
89
|
+
procedure Alternate_silence;
|
90
|
+
|
80
91
|
[Test]
|
81
92
|
[Ignore]
|
82
93
|
procedure Multiple_line_question;
|
94
|
+
|
95
|
+
[Test]
|
96
|
+
[Ignore]
|
97
|
+
procedure Starting_with_whitespace;
|
98
|
+
|
99
|
+
[Test]
|
100
|
+
[Ignore]
|
101
|
+
procedure Ending_with_whitespace;
|
102
|
+
|
103
|
+
[Test]
|
104
|
+
[Ignore]
|
105
|
+
procedure Other_whitespace;
|
106
|
+
|
107
|
+
[Test]
|
108
|
+
[Ignore]
|
109
|
+
procedure Non_question_ending_with_whitespace;
|
83
110
|
end;
|
84
111
|
|
85
112
|
implementation
|
@@ -87,92 +114,122 @@ uses uBob;
|
|
87
114
|
|
88
115
|
procedure BobTests.Stating_something;
|
89
116
|
begin
|
90
|
-
|
117
|
+
Assert.AreEqual('Whatever.', TBob.Response('Tom-ay-to, tom-aaaah-to.'));
|
91
118
|
end;
|
92
119
|
|
93
120
|
procedure BobTests.Shouting;
|
94
121
|
begin
|
95
|
-
|
122
|
+
Assert.AreEqual('Whoa, chill out!', TBob.Response('WATCH OUT!'));
|
96
123
|
end;
|
97
124
|
|
98
125
|
procedure BobTests.Asking_a_question;
|
99
126
|
begin
|
100
|
-
|
127
|
+
Assert.AreEqual('Sure.', TBob.Response('Does this cryogenic chamber make me look fat?'));
|
128
|
+
end;
|
129
|
+
|
130
|
+
procedure BobTests.Asking_gibberish;
|
131
|
+
begin
|
132
|
+
Assert.AreEqual('Sure.',TBob.Response('fffbbcbeab?'));
|
133
|
+
end;
|
134
|
+
|
135
|
+
procedure BobTests.Ending_with_whitespace;
|
136
|
+
begin
|
137
|
+
Assert.AreEqual('Sure.', TBob.Response('Okay if like my spacebar quite a bit? '));
|
101
138
|
end;
|
102
139
|
|
103
|
-
procedure BobTests.
|
140
|
+
procedure BobTests.Alternate_silence;
|
104
141
|
begin
|
105
|
-
|
142
|
+
Assert.AreEqual('Fine. Be that way!', TBob.Response(#9#9#9#9#9#9#9#9#9#9));
|
106
143
|
end;
|
107
144
|
|
108
145
|
procedure BobTests.Asking_a_numeric_question;
|
109
146
|
begin
|
110
|
-
|
147
|
+
Assert.AreEqual('Sure.', TBob.Response('You are, what, like 15?'));
|
111
148
|
end;
|
112
149
|
|
113
150
|
procedure BobTests.Talking_forcefully;
|
114
151
|
begin
|
115
|
-
|
152
|
+
Assert.AreEqual('Whatever.', TBob.Response('Let''s go make out behind the gym!'));
|
116
153
|
end;
|
117
154
|
|
118
|
-
procedure BobTests.
|
155
|
+
procedure BobTests.Using_acronyms_in_regular_speech;
|
119
156
|
begin
|
120
|
-
|
157
|
+
Assert.AreEqual('Whatever.', TBob.Response('It''s OK if you don''t want to go to the DMV.'));
|
121
158
|
end;
|
122
159
|
|
123
160
|
procedure BobTests.Forceful_questions;
|
124
161
|
begin
|
125
|
-
|
162
|
+
Assert.AreEqual('Calm down, I know what I''m doing!', TBob.Response('WHAT THE HELL WERE YOU THINKING?'));
|
126
163
|
end;
|
127
164
|
|
128
165
|
procedure BobTests.Shouting_numbers;
|
129
166
|
begin
|
130
|
-
|
167
|
+
Assert.AreEqual('Whoa, chill out!', TBob.Response('1, 2, 3 GO!'));
|
131
168
|
end;
|
132
169
|
|
133
170
|
procedure BobTests.Only_numbers;
|
134
171
|
begin
|
135
|
-
|
172
|
+
Assert.AreEqual('Whatever.', TBob.Response('1, 2, 3'));
|
173
|
+
end;
|
174
|
+
|
175
|
+
procedure BobTests.Other_whitespace;
|
176
|
+
begin
|
177
|
+
Assert.AreEqual('Fine. Be that way!', TBob.Response(#13#10 + ' ' + #9));
|
136
178
|
end;
|
137
179
|
|
138
180
|
procedure BobTests.Question_with_only_numbers;
|
139
181
|
begin
|
140
|
-
|
182
|
+
Assert.AreEqual('Sure.', TBob.Response('4?'));
|
141
183
|
end;
|
142
184
|
|
143
185
|
procedure BobTests.Shouting_with_special_characters;
|
144
186
|
begin
|
145
|
-
|
187
|
+
Assert.AreEqual('Whoa, chill out!', TBob.Response('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'));
|
146
188
|
end;
|
147
189
|
|
148
190
|
procedure BobTests.Shouting_with_no_exclamation_mark;
|
149
191
|
begin
|
150
|
-
|
192
|
+
Assert.AreEqual('Whoa, chill out!', TBob.Response('I HATE YOU'));
|
193
|
+
end;
|
194
|
+
|
195
|
+
procedure BobTests.Starting_with_whitespace;
|
196
|
+
begin
|
197
|
+
Assert.AreEqual('Whatever.', TBob.Response(' hmmmmmmm...'));
|
151
198
|
end;
|
152
199
|
|
153
200
|
procedure BobTests.Statement_containing_question_mark;
|
154
201
|
begin
|
155
|
-
|
202
|
+
Assert.AreEqual('Whatever.', TBob.Response('Ending with ? means a question.'));
|
156
203
|
end;
|
157
204
|
|
158
205
|
procedure BobTests.Prattling_on;
|
159
206
|
begin
|
160
|
-
|
207
|
+
Assert.AreEqual('Sure.', TBob.Response('Wait! Hang on. Are you going to be OK?'));
|
161
208
|
end;
|
162
209
|
|
163
210
|
procedure BobTests.Silence;
|
164
211
|
begin
|
165
|
-
|
212
|
+
Assert.AreEqual('Fine. Be that way!', TBob.Response(''));
|
166
213
|
end;
|
167
214
|
|
168
215
|
procedure BobTests.Prolonged_silence;
|
169
216
|
begin
|
170
|
-
|
217
|
+
Assert.AreEqual('Fine. Be that way!', TBob.Response(' '));
|
171
218
|
end;
|
172
219
|
|
173
220
|
procedure BobTests.Multiple_line_question;
|
174
221
|
begin
|
175
|
-
|
222
|
+
Assert.AreEqual('Whatever.', TBob.Response('Does this cryogenic chamber make me look fat?' + #13#10 + 'no'));
|
223
|
+
end;
|
224
|
+
|
225
|
+
procedure BobTests.non_letters_with_question;
|
226
|
+
begin
|
227
|
+
Assert.AreEqual('Sure.', TBob.Response(':) ?'));
|
228
|
+
end;
|
229
|
+
|
230
|
+
procedure BobTests.Non_question_ending_with_whitespace;
|
231
|
+
begin
|
232
|
+
Assert.AreEqual('Whatever.', TBob.Response('This is a statement ending with whitespace '));
|
176
233
|
end;
|
177
234
|
|
178
235
|
initialization
|