mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 05:59:28 +02:00
+ Test for automated types.
git-svn-id: trunk@7693 -
This commit is contained in:
parent
3e7a771b69
commit
013107d245
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6453,6 +6453,7 @@ tests/test/cg/taddset2.pp svneol=native#text/plain
|
||||
tests/test/cg/tadint64.pp svneol=native#text/plain
|
||||
tests/test/cg/tassign1.pp svneol=native#text/plain
|
||||
tests/test/cg/tassign2.pp svneol=native#text/plain
|
||||
tests/test/cg/tautom.pp svneol=native#text/x-pascal
|
||||
tests/test/cg/tcalcla1.pp svneol=native#text/plain
|
||||
tests/test/cg/tcalcon1.pp svneol=native#text/plain
|
||||
tests/test/cg/tcalcst1.pp svneol=native#text/plain
|
||||
|
80
tests/test/cg/tautom.pp
Normal file
80
tests/test/cg/tautom.pp
Normal file
@ -0,0 +1,80 @@
|
||||
{%OPT=-glh}
|
||||
program tautom;
|
||||
|
||||
type wstr_varnt_record=record
|
||||
s:widestring;
|
||||
v:variant;
|
||||
end;
|
||||
|
||||
wstr_varnt_object=object
|
||||
s:wstr_varnt_record;
|
||||
end;
|
||||
|
||||
wstr_array1=array[0..99] of wstr_varnt_record;
|
||||
wstr_array2=array[0..99] of wstr_varnt_object;
|
||||
|
||||
|
||||
procedure do_test;
|
||||
|
||||
var a,b:wstr_array1;
|
||||
c,d:wstr_array2;
|
||||
i:0..99;
|
||||
|
||||
|
||||
begin
|
||||
for i:=low(a) to high(a) do
|
||||
begin
|
||||
a[i].s:='Ninja';
|
||||
a[i].v:='Samurai';
|
||||
end;
|
||||
|
||||
b:=a;
|
||||
|
||||
for i:=low(a) to high(a) do
|
||||
begin
|
||||
if a[i].s<>'Ninja' then
|
||||
halt(255);
|
||||
if b[i].s<>'Ninja' then
|
||||
halt(255);
|
||||
if a[i].v<>'Samurai' then
|
||||
halt(255);
|
||||
if b[i].v<>'Samurai' then
|
||||
halt(255);
|
||||
end;
|
||||
|
||||
for i:=0 to 99 do
|
||||
begin
|
||||
c[i].s.s:=a[i].s;
|
||||
c[i].s.v:=a[i].v;
|
||||
end;
|
||||
|
||||
d:=c;
|
||||
for i:=low(d) to high(d) do
|
||||
begin
|
||||
if c[i].s.s<>'Ninja' then
|
||||
halt(255);
|
||||
if d[i].s.s<>'Ninja' then
|
||||
halt(255);
|
||||
if c[i].s.v<>'Samurai' then
|
||||
halt(255);
|
||||
if d[i].s.v<>'Samurai' then
|
||||
halt(255);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
var before,after:sizeuint;
|
||||
|
||||
begin
|
||||
with getfpcheapstatus do
|
||||
before:=currheapused;
|
||||
writeln('Used heap before ',before);
|
||||
|
||||
do_test;
|
||||
|
||||
with getfpcheapstatus do
|
||||
after:=currheapused;
|
||||
writeln('Used heap after ',after);
|
||||
if before<>after then
|
||||
exitcode:=255;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user