mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-27 02:30:57 +02:00
+ Add overloaded Testne function in test1 unit
git-svn-id: trunk@19834 -
This commit is contained in:
parent
4e21fc6373
commit
470adb22e1
@ -201,5 +201,10 @@ BEGIN
|
|||||||
dispose(X);
|
dispose(X);
|
||||||
{ for i:=1 to 99 do
|
{ for i:=1 to 99 do
|
||||||
Writeln('Line ',i); }
|
Writeln('Line ',i); }
|
||||||
|
if (TestOne<>1) or (TestOne(5)<>5) or (TestOne('6')<>6) then
|
||||||
|
begin
|
||||||
|
Writeln('Error while testing TestOne function overloads');
|
||||||
|
RunError(200);
|
||||||
|
end;
|
||||||
Halt(4);
|
Halt(4);
|
||||||
END.
|
END.
|
||||||
|
@ -1,9 +1,37 @@
|
|||||||
unit test1;
|
unit test1;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
{ dummy unit for test of dbx stabs info PM }
|
{ dummy unit for test of dbx stabs info PM }
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
function TestOne : longint;
|
||||||
|
function TestOne(val : longint) : longint; overload;
|
||||||
|
function TestOne(val : string) : longint; overload;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function TestOne : longint;
|
||||||
|
begin
|
||||||
|
result:=1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TestOne(val : longint) : longint; overload;
|
||||||
|
begin
|
||||||
|
result:=val;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TestOne(val : string) : longint; overload;
|
||||||
|
var
|
||||||
|
value, error : longint;
|
||||||
|
begin
|
||||||
|
system.val(val,value,error);
|
||||||
|
if error=0 then
|
||||||
|
result:=value
|
||||||
|
else
|
||||||
|
result:=-1;
|
||||||
|
end;
|
||||||
|
WWWWW
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user