1{%OPT=-glh} 2program tautom; 3 4type wstr_varnt_record=record 5 s:widestring; 6 v:variant; 7 end; 8 9 wstr_varnt_object=object 10 s:wstr_varnt_record; 11 end; 12 13 wstr_array1=array[0..99] of wstr_varnt_record; 14 wstr_array2=array[0..99] of wstr_varnt_object; 15 16 17procedure do_test; 18 19var a,b:wstr_array1; 20 c,d:wstr_array2; 21 i:0..99; 22 23 24begin 25 for i:=low(a) to high(a) do 26 begin 27 a[i].s:='Ninja'; 28 a[i].v:='Samurai'; 29 end; 30 31 b:=a; 32 33 for i:=low(a) to high(a) do 34 begin 35 if a[i].s<>'Ninja' then 36 halt(255); 37 if b[i].s<>'Ninja' then 38 halt(255); 39 if a[i].v<>'Samurai' then 40 halt(255); 41 if b[i].v<>'Samurai' then 42 halt(255); 43 end; 44 45 for i:=0 to 99 do 46 begin 47 c[i].s.s:=a[i].s; 48 c[i].s.v:=a[i].v; 49 end; 50 51 d:=c; 52 for i:=low(d) to high(d) do 53 begin 54 if c[i].s.s<>'Ninja' then 55 halt(255); 56 if d[i].s.s<>'Ninja' then 57 halt(255); 58 if c[i].s.v<>'Samurai' then 59 halt(255); 60 if d[i].s.v<>'Samurai' then 61 halt(255); 62 end; 63end; 64 65 66var before,after:sizeuint; 67 68begin 69 with getfpcheapstatus do 70 before:=currheapused; 71 writeln('Used heap before ',before); 72 73 do_test; 74 75 with getfpcheapstatus do 76 after:=currheapused; 77 writeln('Used heap after ',after); 78 if before<>after then 79 exitcode:=255; 80end. 81