mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 04:52:17 +02:00
* small fixes
This commit is contained in:
parent
fbef0b4610
commit
a576e82342
@ -23,8 +23,11 @@ var
|
|||||||
ival : integer;
|
ival : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
ThousandSeparator:='.';
|
||||||
|
DecimalSeparator:=',';
|
||||||
ival:=1234;
|
ival:=1234;
|
||||||
s:=Format('%10.n', [ival*1.0]);
|
s:=Format('%10.n', [ival*1.0]);
|
||||||
|
writeln('s: "',s,'"');
|
||||||
if s<>' 1.234' then
|
if s<>' 1.234' then
|
||||||
begin
|
begin
|
||||||
writeln('Problem with Format');
|
writeln('Problem with Format');
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
{ %fail% }
|
|
||||||
|
|
||||||
uses
|
|
||||||
Objects;
|
|
||||||
|
|
||||||
var
|
|
||||||
Coll : PCollection;
|
|
||||||
Thing : PObject;
|
|
||||||
|
|
||||||
Line1 : String; {*** This is a global variable ***}
|
|
||||||
|
|
||||||
|
|
||||||
procedure Zero;
|
|
||||||
|
|
||||||
var
|
|
||||||
Line2 : String; {*** This is a local variable ***}
|
|
||||||
|
|
||||||
procedure Two (Thing: PObject);
|
|
||||||
begin
|
|
||||||
Line1 := 'BBB';
|
|
||||||
Line2 := 'BBB';
|
|
||||||
|
|
||||||
WriteLn('2: ', Line1, ' * ', Line2); {*** Output line 2 ***}
|
|
||||||
if Line2<>'BBB' then
|
|
||||||
begin
|
|
||||||
writeln('ERROR!');
|
|
||||||
halt(1);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure One (Thing: PObject);
|
|
||||||
|
|
||||||
procedure LocalTwo (Thing: PObject);
|
|
||||||
begin
|
|
||||||
Line1 := 'BBB';
|
|
||||||
Line2 := 'BBB';
|
|
||||||
|
|
||||||
WriteLn('2: ', Line1, ' * ', Line2); {*** Output line 2 ***}
|
|
||||||
if Line2<>'BBB' then
|
|
||||||
begin
|
|
||||||
writeln('ERROR!');
|
|
||||||
halt(1);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Line1 := 'AAA';
|
|
||||||
Line2 := 'AAA';
|
|
||||||
|
|
||||||
WriteLn('1: ', Line1, ' * ', Line2); {*** Output line 1 ***}
|
|
||||||
|
|
||||||
Coll^.ForEach(@LocalTwo);
|
|
||||||
|
|
||||||
WriteLn('3: ', Line1, ' * ', Line2); {*** Output line 3 ***}
|
|
||||||
if Line2<>'BBB' then
|
|
||||||
begin
|
|
||||||
writeln('ERROR!');
|
|
||||||
halt(1);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{*** I expected that output line 3 ***}
|
|
||||||
begin {*** would be the same as output ***}
|
|
||||||
Coll^.ForEach(@One); {*** line 2. It is not. ***}
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
|
||||||
New(Coll, Init(1, 1));
|
|
||||||
|
|
||||||
New(Thing, Init);
|
|
||||||
Coll^.Insert(Thing);
|
|
||||||
|
|
||||||
Zero;
|
|
||||||
|
|
||||||
Dispose(Coll, Done);
|
|
||||||
end.
|
|
@ -6,13 +6,25 @@ type
|
|||||||
|
|
||||||
procedure Test(const Args: array of TPoint);
|
procedure Test(const Args: array of TPoint);
|
||||||
begin
|
begin
|
||||||
|
{$ifndef VER1_0}
|
||||||
|
writeln(length(Args));
|
||||||
|
if length(Args)<>2 then
|
||||||
|
halt(1);
|
||||||
|
{$endif VER1_0}
|
||||||
|
writeln(high(Args));
|
||||||
|
if high(Args)<>1 then
|
||||||
|
halt(1);
|
||||||
writeln(Args[0].x,',',Args[0].y);
|
writeln(Args[0].x,',',Args[0].y);
|
||||||
if (Args[0].x<>10) and (Args[0].y<>10) then
|
if (Args[0].x<>10) or (Args[0].y<>20) then
|
||||||
|
halt(1);
|
||||||
|
writeln(Args[1].x,',',Args[1].y);
|
||||||
|
if (Args[1].x<>30) or (Args[1].y<>40) then
|
||||||
halt(1);
|
halt(1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
p1: TPoint = (x: 10; y: 10);
|
p1: TPoint = (x: 10; y: 20);
|
||||||
|
p2: TPoint = (x: 30; y: 40);
|
||||||
begin
|
begin
|
||||||
Test([p1]);
|
Test([p1,p2]);
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user