Explorar o código

+ added tests tasm21a.pp and tasm21b.pp - same as tasm21.pp, but for i386 and x86_64

git-svn-id: trunk@38294 -
nickysn %!s(int64=7) %!d(string=hai) anos
pai
achega
8c99f3f70d
Modificáronse 3 ficheiros con 115 adicións e 0 borrados
  1. 2 0
      .gitattributes
  2. 56 0
      tests/test/tasm21a.pp
  3. 57 0
      tests/test/tasm21b.pp

+ 2 - 0
.gitattributes

@@ -12516,6 +12516,8 @@ tests/test/tasm2.inc svneol=native#text/plain
 tests/test/tasm2.pp svneol=native#text/plain
 tests/test/tasm20.pp svneol=native#text/plain
 tests/test/tasm21.pp svneol=native#text/plain
+tests/test/tasm21a.pp svneol=native#text/plain
+tests/test/tasm21b.pp svneol=native#text/plain
 tests/test/tasm2a.pp svneol=native#text/plain
 tests/test/tasm3.pp svneol=native#text/plain
 tests/test/tasm4.pp svneol=native#text/plain

+ 56 - 0
tests/test/tasm21a.pp

@@ -0,0 +1,56 @@
+{ %CPU=i386 }
+
+{$MODE TP}
+
+program tasm21a;
+
+var
+  test2a_ofs, test2b_ofs: longword;
+
+procedure Error;
+begin
+  Writeln('Error!');
+  Halt(1);
+end;
+
+function test1a: longword; assembler;
+asm
+  mov eax, offset test1a;
+end;
+
+function test1b: longword;
+begin
+  asm
+    mov eax, offset test1b;
+    mov @Result, eax
+  end;
+end;
+
+procedure test2a; assembler;
+asm
+  mov eax, offset test2a;
+  mov test2a_ofs, eax
+end;
+
+procedure test2b;
+begin
+  asm
+    mov eax, offset test2b;
+    mov test2b_ofs, eax
+  end;
+end;
+
+begin
+  if test1a <> Ofs(test1a) then
+    Error;
+  if test1b <> Ofs(test1b) then
+    Error;
+  test2a;
+  if test2a_ofs <> Ofs(test2a) then
+    Error;
+  test2b;
+  if test2b_ofs <> Ofs(test2b) then
+    Error;
+
+  Writeln('Ok!');
+end.

+ 57 - 0
tests/test/tasm21b.pp

@@ -0,0 +1,57 @@
+{ %CPU=x86_64 }
+
+{$MODE TP}
+{$ASMMODE INTEL}
+
+program tasm21b;
+
+var
+  test2a_ofs, test2b_ofs: qword;
+
+procedure Error;
+begin
+  Writeln('Error!');
+  Halt(1);
+end;
+
+function test1a: qword; assembler;
+asm
+  mov rax, offset test1a;
+end;
+
+function test1b: qword;
+begin
+  asm
+    mov rax, offset test1b;
+    mov @Result, rax
+  end;
+end;
+
+procedure test2a; assembler;
+asm
+  mov rax, offset test2a;
+  mov test2a_ofs, rax
+end;
+
+procedure test2b;
+begin
+  asm
+    mov rax, offset test2b;
+    mov test2b_ofs, rax
+  end;
+end;
+
+begin
+  if test1a <> Ofs(test1a) then
+    Error;
+  if test1b <> Ofs(test1b) then
+    Error;
+  test2a;
+  if test2a_ofs <> Ofs(test2a) then
+    Error;
+  test2b;
+  if test2b_ofs <> Ofs(test2b) then
+    Error;
+
+  Writeln('Ok!');
+end.