Browse Source

+ some packed array tests

git-svn-id: trunk@4322 -
Jonas Maebe 19 years ago
parent
commit
bd6dc91069
5 changed files with 86 additions and 0 deletions
  1. 4 0
      .gitattributes
  2. 17 0
      tests/test/tparray1.pp
  3. 14 0
      tests/test/tparray2.pp
  4. 21 0
      tests/test/tparray3.pp
  5. 30 0
      tests/test/tparray4.pp

+ 4 - 0
.gitattributes

@@ -6120,6 +6120,10 @@ tests/test/tover2.pp svneol=native#text/plain
 tests/test/tpackrec.pp svneol=native#text/plain
 tests/test/tpackrec.pp svneol=native#text/plain
 tests/test/tpara1.pp svneol=native#text/plain
 tests/test/tpara1.pp svneol=native#text/plain
 tests/test/tpara2.pp svneol=native#text/plain
 tests/test/tpara2.pp svneol=native#text/plain
+tests/test/tparray1.pp svneol=native#text/plain
+tests/test/tparray2.pp svneol=native#text/plain
+tests/test/tparray3.pp svneol=native#text/plain
+tests/test/tparray4.pp svneol=native#text/plain
 tests/test/tpftch1.pp svneol=native#text/plain
 tests/test/tpftch1.pp svneol=native#text/plain
 tests/test/tprocext.pp svneol=native#text/plain
 tests/test/tprocext.pp svneol=native#text/plain
 tests/test/tprocvar1.pp svneol=native#text/plain
 tests/test/tprocvar1.pp svneol=native#text/plain

+ 17 - 0
tests/test/tparray1.pp

@@ -0,0 +1,17 @@
+{ %fail }
+
+{$mode macpas}
+
+type
+  tba = array[0..7] of boolean;
+  tkeymap = packed array[0..3] of tba;
+
+procedure test(var b: tba);
+begin
+end;
+
+var
+  km: tkeymap;
+begin
+  test(km[1]);
+end.

+ 14 - 0
tests/test/tparray2.pp

@@ -0,0 +1,14 @@
+{ %fail }
+
+{$mode macpas}
+
+type
+  tba = array[0..7] of boolean;
+  tkeymap = packed array[0..3] of tba;
+
+var
+  p: pointer;
+begin
+  p := @km[2];
+end.
+

+ 21 - 0
tests/test/tparray3.pp

@@ -0,0 +1,21 @@
+{ %fail }
+
+{$mode macpas}
+
+type
+  tba = array[0..7] of boolean;
+  tkeymap = packed array[0..3] of tba;
+
+procedure test(var b: tba);
+begin
+end;
+
+var
+  km: tkeymap;
+  i: longint;
+  a: tba;
+begin
+  i := 1;
+  fillchar(a,sizeof(a),0);
+  km[i] := a;
+end.

+ 30 - 0
tests/test/tparray4.pp

@@ -0,0 +1,30 @@
+{$mode macpas}
+
+program tparray4;
+
+type
+{$ifc defined __GPC__}
+    Int32 = Integer attribute ( size = 32);
+{$elsec}
+    Int32 = longint;
+{$endif}
+
+type
+  GPCKeyMap = packed array[0..127] of boolean;
+  FPCKeyMap = array [0..3] of Int32;
+
+var
+  km: GPCKeymap;
+begin
+  fillchar(km,sizeof(km),0);
+  km[56] := true;
+  if (FPCKeyMap(km)[0] <> 0) or
+     (FPCKeyMap(km)[1] <> 128) or
+     (FPCKeyMap(km)[2] <> 0) or
+     (FPCKeyMap(km)[3] <> 0) then
+    begin
+      writeln('error');
+      halt(1);
+    end;
+end.
+