mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 01:08:07 +02:00
* extend test for interface helper by tests for "inherited"
git-svn-id: trunk@37061 -
This commit is contained in:
parent
6acba684d4
commit
ec7a17d1e3
@ -34,11 +34,16 @@ type
|
||||
function Blubb: LongInt;
|
||||
function Foobar(aArg: LongInt): LongInt; overload;
|
||||
function Test: LongInt;
|
||||
function Calculate: LongInt;
|
||||
function CalculateBase: LongInt;
|
||||
class function TestStatic: LongInt; static;
|
||||
end;
|
||||
|
||||
TTestIntfSubSubHelper = type helper(TTestIntfHelper) for ITestIntfSubSub
|
||||
function SomethingElse: LongInt;
|
||||
function Calculate: LongInt;
|
||||
function CalculateBase: LongInt;
|
||||
function CalculateBase2: LongInt;
|
||||
end;
|
||||
|
||||
{ TTestSubSub }
|
||||
@ -62,6 +67,21 @@ begin
|
||||
Result := 7;
|
||||
end;
|
||||
|
||||
function TTestIntfSubSubHelper.Calculate: LongInt;
|
||||
begin
|
||||
Result := 100 * SomethingElse + inherited Calculate;
|
||||
end;
|
||||
|
||||
function TTestIntfSubSubHelper.CalculateBase: LongInt;
|
||||
begin
|
||||
Result := 100 * inherited SomethingElse + inherited CalculateBase;
|
||||
end;
|
||||
|
||||
function TTestIntfSubSubHelper.CalculateBase2: LongInt;
|
||||
begin
|
||||
Result := 100 * inherited SomethingElse + inherited Calculate;
|
||||
end;
|
||||
|
||||
{ TTest }
|
||||
|
||||
function TTest.Blubb: LongInt;
|
||||
@ -91,6 +111,16 @@ begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TTestIntfHelper.Calculate: LongInt;
|
||||
begin
|
||||
Result := 10 * Blubb + Foobar;
|
||||
end;
|
||||
|
||||
function TTestIntfHelper.CalculateBase: LongInt;
|
||||
begin
|
||||
Result := 10 * inherited Blubb + inherited Foobar;
|
||||
end;
|
||||
|
||||
class function TTestIntfHelper.TestStatic: LongInt;
|
||||
begin
|
||||
Result := 2;
|
||||
@ -114,20 +144,30 @@ begin
|
||||
Halt(5);
|
||||
if i.Foobar(6) <> 6 then
|
||||
Halt(6);
|
||||
if i.Calculate <> 35 then
|
||||
Halt(7);
|
||||
if i.CalculateBase <> 45 then
|
||||
Halt(8);
|
||||
i := Nil;
|
||||
|
||||
_is := TTestSub.Create;
|
||||
if _is.Blubb <> 3 then
|
||||
Halt(7);
|
||||
Halt(9);
|
||||
if _is.Foobar(8) <> 8 then
|
||||
Halt(8);
|
||||
Halt(10);
|
||||
_is := Nil;
|
||||
|
||||
iss := TTestSubSub.Create;
|
||||
if iss.SomethingElse <> 7 then
|
||||
Halt(9);
|
||||
Halt(11);
|
||||
if iss.Blubb <> 3 then
|
||||
Halt(10);
|
||||
Halt(12);
|
||||
if iss.Calculate <> 735 then
|
||||
Halt(13);
|
||||
if iss.CalculateBase <> 945 then
|
||||
Halt(14);
|
||||
if iss.CalculateBase2 <> 935 then
|
||||
Halt(15);
|
||||
iss := Nil;
|
||||
|
||||
Writeln('ok');
|
||||
|
Loading…
Reference in New Issue
Block a user