mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:39:36 +02:00
+ added test tfarptr2.pp, which tests far pointer equality comparison
git-svn-id: trunk@25108 -
This commit is contained in:
parent
1eaa23b738
commit
56fbf8d4fe
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10592,6 +10592,7 @@ tests/test/cg/variants/tvarol91.pp svneol=native#text/plain
|
|||||||
tests/test/cg/variants/tvarol94.pp svneol=native#text/plain
|
tests/test/cg/variants/tvarol94.pp svneol=native#text/plain
|
||||||
tests/test/cg/variants/tvarol96.pp svneol=native#text/plain
|
tests/test/cg/variants/tvarol96.pp svneol=native#text/plain
|
||||||
tests/test/cpu16/i8086/tfarptr1.pp svneol=native#text/pascal
|
tests/test/cpu16/i8086/tfarptr1.pp svneol=native#text/pascal
|
||||||
|
tests/test/cpu16/i8086/tfarptr2.pp svneol=native#text/pascal
|
||||||
tests/test/cpu16/i8086/tptrsize.pp svneol=native#text/pascal
|
tests/test/cpu16/i8086/tptrsize.pp svneol=native#text/pascal
|
||||||
tests/test/cpu16/taddint1.pp svneol=native#text/pascal
|
tests/test/cpu16/taddint1.pp svneol=native#text/pascal
|
||||||
tests/test/dumpclass.pp svneol=native#text/plain
|
tests/test/dumpclass.pp svneol=native#text/plain
|
||||||
|
60
tests/test/cpu16/i8086/tfarptr2.pp
Normal file
60
tests/test/cpu16/i8086/tfarptr2.pp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{ %cpu=i8086 }
|
||||||
|
|
||||||
|
{ far pointer equality comparison tests }
|
||||||
|
|
||||||
|
var
|
||||||
|
ErrorCode: Integer;
|
||||||
|
|
||||||
|
procedure Error(Code: Integer);
|
||||||
|
begin
|
||||||
|
Writeln('Error: ', code);
|
||||||
|
ErrorCode := Code;
|
||||||
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
TFarPtrRec = packed record
|
||||||
|
offset: Word;
|
||||||
|
segment: Word;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
FarPtr: FarPointer;
|
||||||
|
FarPtr2: FarPointer;
|
||||||
|
FarPtrRec: TFarPtrRec absolute FarPtr;
|
||||||
|
eq, neq: Boolean;
|
||||||
|
begin
|
||||||
|
ErrorCode := 0;
|
||||||
|
|
||||||
|
FarPtr := Ptr($1234, $5678);
|
||||||
|
FarPtr2 := Ptr($1234, $5678);
|
||||||
|
eq := FarPtr = FarPtr2;
|
||||||
|
neq := FarPtr <> FarPtr2;
|
||||||
|
if not eq or neq then
|
||||||
|
Error(1);
|
||||||
|
|
||||||
|
FarPtr := Ptr($1234, $5678);
|
||||||
|
FarPtr2 := Ptr($4321, $5678);
|
||||||
|
eq := FarPtr = FarPtr2;
|
||||||
|
neq := FarPtr <> FarPtr2;
|
||||||
|
if eq or not neq then
|
||||||
|
Error(2);
|
||||||
|
|
||||||
|
FarPtr := Ptr($1234, $5678);
|
||||||
|
FarPtr2 := Ptr($1234, $8765);
|
||||||
|
eq := FarPtr = FarPtr2;
|
||||||
|
neq := FarPtr <> FarPtr2;
|
||||||
|
if eq or not neq then
|
||||||
|
Error(3);
|
||||||
|
|
||||||
|
FarPtr := Ptr($1234, $5678);
|
||||||
|
FarPtr2 := Ptr($4321, $8765);
|
||||||
|
eq := FarPtr = FarPtr2;
|
||||||
|
neq := FarPtr <> FarPtr2;
|
||||||
|
if eq or not neq then
|
||||||
|
Error(4);
|
||||||
|
|
||||||
|
if ErrorCode = 0 then
|
||||||
|
Writeln('Success!')
|
||||||
|
else
|
||||||
|
Halt(ErrorCode);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user