|
@@ -14,10 +14,16 @@ procedure RomanToIntTest(const testRoman: string;
|
|
|
var
|
|
|
test: integer;
|
|
|
begin
|
|
|
- test := RomanToInt(testRoman);
|
|
|
+ try
|
|
|
+ test := RomanToInt(testRoman);
|
|
|
+ except
|
|
|
+ { make sure that if an exception is generated,
|
|
|
+ the error is raised }
|
|
|
+ test:=expectation-1;
|
|
|
+ end;
|
|
|
if test <> expectation then
|
|
|
begin
|
|
|
- writeln('Testing strUtils/RomanToInt: Test with ', testRoman, ' failed.');
|
|
|
+ writeln('Testing strUtils/RomanToInt: Test with "', testRoman, '" failed.');
|
|
|
writeln('Returned number: ', test);
|
|
|
writeln('Expected number: ', expectation);
|
|
|
exitCode := 1;
|
|
@@ -30,6 +36,9 @@ var
|
|
|
testInteger: integer;
|
|
|
|
|
|
begin
|
|
|
+ { Check that empty string is accepted as zero vvalue }
|
|
|
+ RomanToIntTest('',0);
|
|
|
+
|
|
|
for i := 1 to 2000 do
|
|
|
begin
|
|
|
testInteger := i;
|