mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 02:59:21 +02:00
* fixed test
* single variant of the test git-svn-id: trunk@6020 -
This commit is contained in:
parent
a94a681603
commit
5d2b592ed4
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -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/tidos2.pp svneol=native#text/plain
|
||||||
tests/test/units/dos/tverify.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/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/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/tnaninf.pp svneol=native#text/plain
|
||||||
tests/test/units/math/ttrig1.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
|
tests/test/units/objects/testobj.pp svneol=native#text/plain
|
||||||
|
60
tests/test/units/math/tmask.inc
Normal file
60
tests/test/units/math/tmask.inc
Normal 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.
|
@ -8,63 +8,5 @@ var
|
|||||||
f1,f2 : double;
|
f1,f2 : double;
|
||||||
caught: boolean;
|
caught: boolean;
|
||||||
|
|
||||||
begin
|
{$include tmask.inc}
|
||||||
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(0);
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
11
tests/test/units/math/tmask2.pp
Normal file
11
tests/test/units/math/tmask2.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
program fpu;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
uses SysUtils,Math;
|
||||||
|
|
||||||
|
var
|
||||||
|
f1,f2 : single;
|
||||||
|
caught: boolean;
|
||||||
|
|
||||||
|
{$include tmask.inc}
|
Loading…
Reference in New Issue
Block a user