* fixed test

* single variant of the test

git-svn-id: trunk@6020 -
This commit is contained in:
florian 2007-01-17 08:26:54 +00:00
parent a94a681603
commit 5d2b592ed4
4 changed files with 74 additions and 59 deletions

2
.gitattributes vendored
View File

@ -6835,7 +6835,9 @@ tests/test/units/dos/tidos.pp svneol=native#text/plain
tests/test/units/dos/tidos2.pp svneol=native#text/plain
tests/test/units/dos/tverify.pp svneol=native#text/plain
tests/test/units/dos/tversion.pp svneol=native#text/plain
tests/test/units/math/tmask.inc svneol=native#text/plain
tests/test/units/math/tmask.pp svneol=native#text/plain
tests/test/units/math/tmask2.pp svneol=native#text/plain
tests/test/units/math/tnaninf.pp svneol=native#text/plain
tests/test/units/math/ttrig1.pp svneol=native#text/plain
tests/test/units/objects/testobj.pp svneol=native#text/plain

View File

@ -0,0 +1,60 @@
begin
f1:=1.0;
f2:=0.0;
caught := false;
try
writeln('dividing by zero without having disabled FPU Exceptions...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured: ',E.Message);
caught := true;
end;
end;
if not caught then
halt(1);
writeln('Masking exceptions');
writeln(integer(SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow,exZeroDivide]))); //Returns 61, as expected
writeln(integer(GetExceptionMask)); //Returns 4 - unexpected???
writeln(integer([exZeroDivide])); //Returns 4
caught := false;
try
writeln('dividing by zero with FPU Exceptions disabled...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured: ',E.Message);
caught := true;
end;
end;
if caught then
halt(2);
writeln(integer(SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow]))); //Returns 61, as expected
writeln(integer(GetExceptionMask)); //Returns 4 - unexpected???
writeln(integer([exZeroDivide])); //Returns 4
caught := false;
try
writeln('dividing by zero without having disabled FPU Exceptions...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured: ',E.Message);
caught := true;
end;
end;
if not caught then
halt(2);
writeln('ok');
end.

View File

@ -8,63 +8,5 @@ var
f1,f2 : double;
caught: boolean;
begin
f1:=1.0;
f2:=0.0;
caught := false;
try
writeln('dividing by zero without having disabled FPU Exceptions...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured:',E.Message);
caught := true;
end;
end;
{$include tmask.inc}
if not caught then
halt(1);
writeln('Masking exceptions');
writeln(integer(SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow,exZeroDivide]))); //Returns 61, as expected
writeln(integer(GetExceptionMask)); //Returns 4 - unexpected???
writeln(integer([exZeroDivide])); //Returns 4
caught := false;
try
writeln('dividing by zero with FPU Exceptions disabled...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured:',E.Message);
caught := true;
end;
end;
if caught then
halt(2);
writeln(integer(SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow]))); //Returns 61, as expected
writeln(integer(GetExceptionMask)); //Returns 4 - unexpected???
writeln(integer([exZeroDivide])); //Returns 4
caught := false;
try
writeln('dividing by zero without having disabled FPU Exceptions...');
writeln(f1/f2);
writeln('no exception was raised');
except on E:Exception do
begin
writeln('Exception occured:',E.Message);
caught := true;
end;
end;
if not caught then
halt(0);
end.

View File

@ -0,0 +1,11 @@
program fpu;
{$mode delphi}
uses SysUtils,Math;
var
f1,f2 : single;
caught: boolean;
{$include tmask.inc}