Browse Source

* qword(longint) test

peter 21 years ago
parent
commit
26c0a0a3f3
1 changed files with 16 additions and 1 deletions
  1. 16 1
      tests/test/tcint64.pp

+ 16 - 1
tests/test/tcint64.pp

@@ -9,8 +9,10 @@ const
    i1 : int64 = $ffffffff;
    i1 : int64 = $ffffffff;
    u2 : qword = -1;
    u2 : qword = -1;
    i2 : int64 = -1;
    i2 : int64 = -1;
-
+var
+  l : longint;   
 begin
 begin
+  l:=-1;
   Writeln(' qword($ffffffff) = ',u1);
   Writeln(' qword($ffffffff) = ',u1);
   Writeln(' int64($ffffffff) = ',i1);
   Writeln(' int64($ffffffff) = ',i1);
   Writeln(' qword(-1) = ',u2);
   Writeln(' qword(-1) = ',u2);
@@ -21,4 +23,17 @@ begin
       Writeln('generates a wrong int64 constant');
       Writeln('generates a wrong int64 constant');
       RunError(1);
       RunError(1);
     end;
     end;
+    
+  if u2<>qword(int64(l)) then
+    begin
+      Writeln('"const u2 : qword = -1;" code');
+      Writeln('generates a wrong int64 constant');
+      RunError(1);
+    end;
+
+  if qword(l)<>u2 then
+    begin
+      writeln('qword(longint) sign extension generates wrong code');
+      halt(1);
+    end;
 end.
 end.