瀏覽代碼

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

git-svn-id: trunk@28165 -
nickysn 11 年之前
父節點
當前提交
c8c842b857
共有 1 個文件被更改,包括 22 次插入4 次删除
  1. 22 4
      tests/test/cpu16/i8086/tfarptr2.pp

+ 22 - 4
tests/test/cpu16/i8086/tfarptr2.pp

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