Browse Source

Correct tseg.pp test for i8086 CPPU for which seg/cseg/dseg/sseg should NOT return zero values

git-svn-id: trunk@33770 -
pierre 9 years ago
parent
commit
6646a0d29f
1 changed files with 20 additions and 6 deletions
  1. 20 6
      tests/test/units/system/tseg.pp

+ 20 - 6
tests/test/units/system/tseg.pp

@@ -2,6 +2,14 @@
 { Carl Eric Codere Copyright (c) 2002 }
 { Carl Eric Codere Copyright (c) 2002 }
 program tseg;
 program tseg;
 
 
+{$ifdef CPUI8086}
+const
+  seg_should_be_zero = false;
+{$else}
+const
+  seg_should_be_zero = true;
+{$endif}
+
 const
 const
  cst : integer = 0;
  cst : integer = 0;
 var
 var
@@ -16,7 +24,8 @@ procedure fail;
 procedure test_cseg;
 procedure test_cseg;
  begin
  begin
    Write('Testing CSeg()...');
    Write('Testing CSeg()...');
-   if cseg <> 0 then
+   if ((cseg <> 0) and seg_should_be_zero) or
+      ((cseg=0) and not seg_should_be_zero) then
      fail
      fail
    else
    else
      WriteLn('Success!');
      WriteLn('Success!');
@@ -25,7 +34,8 @@ procedure test_cseg;
 procedure test_dseg;
 procedure test_dseg;
  begin
  begin
    Write('Testing DSeg()...');
    Write('Testing DSeg()...');
-   if dseg <> 0 then
+   if ((dseg <> 0) and seg_should_be_zero) or
+      ((dseg=0) and not seg_should_be_zero) then
      fail
      fail
    else
    else
      WriteLn('Success!');
      WriteLn('Success!');
@@ -34,7 +44,8 @@ procedure test_dseg;
 procedure test_sseg;
 procedure test_sseg;
  begin
  begin
    Write('Testing SSeg()...');
    Write('Testing SSeg()...');
-   if sseg <> 0 then
+   if ((sseg <> 0) and seg_should_be_zero) or
+      ((sseg=0) and not seg_should_be_zero) then
      fail
      fail
    else
    else
      WriteLn('Success!');
      WriteLn('Success!');
@@ -47,11 +58,14 @@ procedure test_seg;
  begin
  begin
    _result := true;
    _result := true;
    Write('Testing Seg()...');
    Write('Testing Seg()...');
-   if seg(x) <> 0 then
+   if ((seg(x) <> 0) and seg_should_be_zero) or
+      ((seg(x)=0) and not seg_should_be_zero) then
      _result := false;
      _result := false;
-   if seg(cst) <> 0 then
+   if ((seg(cst) <> 0) and seg_should_be_zero) or
+      ((seg(cst)=0) and not seg_should_be_zero) then
      _result := false;
      _result := false;
-   if seg(variable) <> 0 then
+   if ((seg(variable) <> 0) and seg_should_be_zero) or
+      ((seg(variable)=0) and not seg_should_be_zero) then
      _result := false;
      _result := false;
    if not _result then
    if not _result then
      fail
      fail