Forráskód Böngészése

Merged revisions 1591,1603,1605 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

r1591 (florian)
* more dyn. array -> variant stuff


r1603 (florian)
* fixed dyn. array to variant array conversion for one dimensional arrays


r1605 (florian)
* fixed multi dimensional dyn. array to variant array

git-svn-id: branches/fixes_2_0@1607 -

florian 20 éve
szülő
commit
04d9fa1691
2 módosított fájl, 37 hozzáadás és 0 törlés
  1. 1 0
      .gitattributes
  2. 36 0
      tests/test/testv9.pp

+ 1 - 0
.gitattributes

@@ -5033,6 +5033,7 @@ tests/test/testv5.pp svneol=native#text/plain
 tests/test/testv6.pp svneol=native#text/plain
 tests/test/testv7.pp svneol=native#text/plain
 tests/test/testv8.pp svneol=native#text/plain
+tests/test/testv9.pp svneol=native#text/plain
 tests/test/texception1.pp svneol=native#text/plain
 tests/test/texception10.pp svneol=native#text/plain
 tests/test/texception2.pp svneol=native#text/plain

+ 36 - 0
tests/test/testv9.pp

@@ -0,0 +1,36 @@
+{$mode objfpc}
+uses
+  Variants;
+
+var
+  a : array of longint;
+  a2 : array of array of longint;
+  v : variant;
+  i,j : longint;
+begin
+  setlength(a,1000);
+  for i:=0 to high(a) do
+    a[i]:=i;
+  v:=a;
+  for i:=0 to high(a) do
+    if v[i]<>i then
+      begin
+        writeln('v[',i,']=',v[i]);
+        halt(1);
+      end;
+  writeln('simple test ok');
+
+  setlength(a2,10,30);
+  for i:=0 to high(a2) do
+    for j:=0 to high(a2[i]) do
+      a2[i,j]:=i*j;
+  v:=a2;
+  for i:=0 to high(a2) do
+    for j:=0 to high(a2[i]) do
+    if v[i,j]<>i*j then
+      begin
+        writeln('v[',i,',',j,']=',v[i,j]);
+        halt(1);
+      end;
+  writeln('complex test ok');
+end.