+ added tests for >, <, >= and <= with equal pointers in the tfarptr2.pp test

git-svn-id: trunk@28165 -
This commit is contained in:
nickysn 2014-07-05 15:15:23 +00:00
parent 5097b90e39
commit c8c842b857

View File

@ -4,6 +4,7 @@
{ = and <> should compare *both* the segment and the offset }
{ >, <, >= and <= should compare only the offset }
{ note: >, <, >= and <= are tested only with equal pointers in this test }
var
ErrorCode: Integer;
@ -25,6 +26,7 @@ var
FarPtr2: FarPointer;
FarPtrRec: TFarPtrRec absolute FarPtr;
eq, neq: Boolean;
lt, gt, lteq, gteq: Boolean;
begin
ErrorCode := 0;
@ -33,7 +35,11 @@ begin
FarPtr2 := Ptr($1234, $5678);
eq := FarPtr = FarPtr2;
neq := FarPtr <> FarPtr2;
if not eq or neq then
lt := FarPtr < FarPtr2;
lteq := FarPtr <= FarPtr2;
gt := FarPtr > FarPtr2;
gteq := FarPtr >= FarPtr2;
if not eq or neq or lt or not lteq or gt or not gteq then
Error(1);
FarPtr := Ptr($1234, $5678);
@ -68,7 +74,11 @@ begin
FarPtr := Ptr($1234, $5678);
eq := FarPtr = Ptr($1234, $5678);
neq := FarPtr <> Ptr($1234, $5678);
if not eq or neq then
lt := FarPtr < Ptr($1234, $5678);
lteq := FarPtr <= Ptr($1234, $5678);
gt := FarPtr > Ptr($1234, $5678);
gteq := FarPtr >= Ptr($1234, $5678);
if not eq or neq or lt or not lteq or gt or not gteq then
Error(1);
FarPtr := Ptr($1234, $5678);
@ -98,7 +108,11 @@ begin
Writeln('ptr(const), ptr(const)');
eq := Ptr($1234, $5678) = Ptr($1234, $5678);
neq := Ptr($1234, $5678) <> Ptr($1234, $5678);
if not eq or neq then
lt := Ptr($1234, $5678) < Ptr($1234, $5678);
lteq := Ptr($1234, $5678) <= Ptr($1234, $5678);
gt := Ptr($1234, $5678) > Ptr($1234, $5678);
gteq := Ptr($1234, $5678) >= Ptr($1234, $5678);
if not eq or neq or lt or not lteq or gt or not gteq then
Error(1);
eq := Ptr($1234, $5678) = Ptr($4321, $5678);
@ -125,7 +139,11 @@ begin
FarPtr := Ptr(0, 0);
eq := FarPtr = nil;
neq := FarPtr <> nil;
if not eq or neq then
lt := FarPtr < nil;
lteq := FarPtr <= nil;
gt := FarPtr > nil;
gteq := FarPtr >= nil;
if not eq or neq or lt or not lteq or gt or not gteq then
Error(1);
FarPtr := Ptr(0, 1);