From 6646a0d29f59fa92b1a87da83efd73f44226c5f1 Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 23 May 2016 20:58:37 +0000 Subject: [PATCH] Correct tseg.pp test for i8086 CPPU for which seg/cseg/dseg/sseg should NOT return zero values git-svn-id: trunk@33770 - --- tests/test/units/system/tseg.pp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/test/units/system/tseg.pp b/tests/test/units/system/tseg.pp index 82d5f3a8d3..d13e160044 100644 --- a/tests/test/units/system/tseg.pp +++ b/tests/test/units/system/tseg.pp @@ -2,6 +2,14 @@ { Carl Eric Codere Copyright (c) 2002 } program tseg; +{$ifdef CPUI8086} +const + seg_should_be_zero = false; +{$else} +const + seg_should_be_zero = true; +{$endif} + const cst : integer = 0; var @@ -16,7 +24,8 @@ procedure fail; procedure test_cseg; begin 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 else WriteLn('Success!'); @@ -25,7 +34,8 @@ procedure test_cseg; procedure test_dseg; begin 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 else WriteLn('Success!'); @@ -34,7 +44,8 @@ procedure test_dseg; procedure test_sseg; begin 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 else WriteLn('Success!'); @@ -47,11 +58,14 @@ procedure test_seg; begin _result := true; 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; - 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; - 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; if not _result then fail