mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:46:00 +02:00
+ test enhanced
This commit is contained in:
parent
2a901bf527
commit
6d02ebf1b8
@ -27,15 +27,48 @@ begin
|
|||||||
i:=100;
|
i:=100;
|
||||||
try
|
try
|
||||||
exception_called:=false;
|
exception_called:=false;
|
||||||
|
j := i div j;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
begin
|
||||||
|
Writeln('First integer exception called ',e.message);
|
||||||
|
exception_called:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
test_exception('First division by zero for integers');
|
||||||
|
try
|
||||||
|
exception_called:=false;
|
||||||
|
j := i div j;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
begin
|
||||||
|
Writeln('Second integer exception called ',e.message);
|
||||||
|
exception_called:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
test_exception('Second division by zero for integers');
|
||||||
|
try
|
||||||
|
exception_called:=false;
|
||||||
e:=i/j;
|
e:=i/j;
|
||||||
except
|
except
|
||||||
on e : exception do
|
on e : exception do
|
||||||
begin
|
begin
|
||||||
Writeln('exception called ',e.message);
|
Writeln('First real exception called ',e.message);
|
||||||
exception_called:=true;
|
exception_called:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
test_exception('division by zero for reals');
|
test_exception('First division by zero for reals');
|
||||||
|
try
|
||||||
|
exception_called:=false;
|
||||||
|
e:=i/j;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
begin
|
||||||
|
Writeln('Second real exception called ',e.message);
|
||||||
|
exception_called:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
test_exception('Second division by zero for reals');
|
||||||
try
|
try
|
||||||
exception_called:=false;
|
exception_called:=false;
|
||||||
j := i div j;
|
j := i div j;
|
||||||
@ -46,7 +79,7 @@ begin
|
|||||||
exception_called:=true;
|
exception_called:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
test_exception('division by zero for integers');
|
test_exception('third division by zero for integers');
|
||||||
exception_count:=0;
|
exception_count:=0;
|
||||||
for j:=1 to TestNumber do
|
for j:=1 to TestNumber do
|
||||||
begin
|
begin
|
||||||
@ -66,6 +99,10 @@ begin
|
|||||||
program_has_errors:=true;
|
program_has_errors:=true;
|
||||||
Writeln('Could not generate ',TestNumber,' consecutive exceptions');
|
Writeln('Could not generate ',TestNumber,' consecutive exceptions');
|
||||||
Writeln('Only ',exception_count,' exceptions were generated');
|
Writeln('Only ',exception_count,' exceptions were generated');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Writeln(TestNumber,' consecutive exceptions generated successfully');
|
||||||
end;
|
end;
|
||||||
try
|
try
|
||||||
exception_called:=false;
|
exception_called:=false;
|
||||||
|
Loading…
Reference in New Issue
Block a user