Browse Source

+ extended test tfarptr2.pp

git-svn-id: trunk@25109 -
nickysn 12 years ago
parent
commit
0d565aeba9
1 changed files with 51 additions and 1 deletions
  1. 51 1
      tests/test/cpu16/i8086/tfarptr2.pp

+ 51 - 1
tests/test/cpu16/i8086/tfarptr2.pp

@@ -1,6 +1,9 @@
 { %cpu=i8086 }
 { %cpu=i8086 }
 
 
-{ far pointer equality comparison tests }
+{ far pointer equality (=, <>) comparison tests }
+
+{ = and <> should compare *both* the segment and the offset }
+{ >, <, >= and <= should compare only the offset }
 
 
 var
 var
   ErrorCode: Integer;
   ErrorCode: Integer;
@@ -25,6 +28,7 @@ var
 begin
 begin
   ErrorCode := 0;
   ErrorCode := 0;
 
 
+  Writeln('var, var');
   FarPtr := Ptr($1234, $5678);
   FarPtr := Ptr($1234, $5678);
   FarPtr2 := Ptr($1234, $5678);
   FarPtr2 := Ptr($1234, $5678);
   eq := FarPtr = FarPtr2;
   eq := FarPtr = FarPtr2;
@@ -53,6 +57,52 @@ begin
   if eq or not neq then
   if eq or not neq then
     Error(4);
     Error(4);
 
 
+  Writeln('var, ptr(const)');
+  FarPtr := Ptr($1234, $5678);
+  eq := FarPtr = Ptr($1234, $5678);
+  neq := FarPtr <> Ptr($1234, $5678);
+  if not eq or neq then
+    Error(1);
+
+  FarPtr := Ptr($1234, $5678);
+  eq := FarPtr = Ptr($4321, $5678);
+  neq := FarPtr <> Ptr($4321, $5678);
+  if eq or not neq then
+    Error(2);
+
+  FarPtr := Ptr($1234, $5678);
+  eq := FarPtr = Ptr($1234, $8765);
+  neq := FarPtr <> Ptr($1234, $8765);
+  if eq or not neq then
+    Error(3);
+
+  FarPtr := Ptr($1234, $5678);
+  eq := FarPtr = Ptr($4321, $8765);
+  neq := FarPtr <> Ptr($4321, $8765);
+  if eq or not neq then
+    Error(4);
+
+  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
+    Error(1);
+
+  eq := Ptr($1234, $5678) = Ptr($4321, $5678);
+  neq := Ptr($1234, $5678) <> Ptr($4321, $5678);
+  if eq or not neq then
+    Error(2);
+
+  eq := Ptr($1234, $5678) = Ptr($1234, $8765);
+  neq := Ptr($1234, $5678) <> Ptr($1234, $8765);
+  if eq or not neq then
+    Error(3);
+
+  eq := Ptr($1234, $5678) = Ptr($4321, $8765);
+  neq := Ptr($1234, $5678) <> Ptr($4321, $8765);
+  if eq or not neq then
+    Error(4);
+
   if ErrorCode = 0 then
   if ErrorCode = 0 then
     Writeln('Success!')
     Writeln('Success!')
   else
   else