Bladeren bron

+ check for local var

pierre 25 jaren geleden
bovenliggende
commit
f0ea08740f
1 gewijzigde bestanden met toevoegingen van 40 en 4 verwijderingen
  1. 40 4
      tests/test/testintl.pp

+ 40 - 4
tests/test/testintl.pp

@@ -16,6 +16,30 @@ asm
 end;
 
 
+function get_local_value : longint;
+var
+  x : longint;
+begin
+  x:=66;
+  asm
+    mov eax,dword ptr [x]
+    mov @result,eax
+  end;
+end;
+
+function get_local_addr : pointer;
+var
+  x : longint;
+begin
+  x:=66;
+  asm
+    mov eax,x
+    mov @result,eax
+  end;
+end;
+
+const
+  program_has_error : boolean = false;
 {$endif CPU86}
 
 begin
@@ -23,13 +47,25 @@ begin
   sti:=56;
   if get_sti_value<>sti then
     begin
-      Writeln(' "mov eax,sti" does not get the address of sti var');
-      Halt(1);
+      Writeln(' "mov eax,dword ptr [sti]" does not get the value of static sti var');
+      program_has_error:=true;
     end;
   if get_sti_addr<>@sti then
     begin
       Writeln(' "mov eax,sti" does not get the address of sti var');
-      Halt(1);
+      program_has_error:=true;
+    end;
+  if get_local_value<>66 then
+    begin
+      Writeln(' "mov eax,dword ptr [x]" does not get the value of local x var');
+      program_has_error:=true;
+    end;
+  if longint(get_local_addr)=66 then
+    begin
+      Writeln(' "mov eax,x"  gets the value of local x var');
+      program_has_error:=true;
     end;
+  if program_has_error then
+    Halt(1);
 {$endif CPU86}
-end.
+end.