Browse Source

* fixed test
* single variant of the test

git-svn-id: trunk@6020 -

florian 18 years ago
parent
commit
5d2b592ed4
4 changed files with 74 additions and 59 deletions
  1. 2 0
      .gitattributes
  2. 60 0
      tests/test/units/math/tmask.inc
  3. 1 59
      tests/test/units/math/tmask.pp
  4. 11 0
      tests/test/units/math/tmask2.pp

+ 2 - 0
.gitattributes

@@ -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

+ 60 - 0
tests/test/units/math/tmask.inc

@@ -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.

+ 1 - 59
tests/test/units/math/tmask.pp

@@ -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.

+ 11 - 0
tests/test/units/math/tmask2.pp

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