From ec7a17d1e3d873376121c192ff2673586aa2458d Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 25 Aug 2017 19:37:44 +0000 Subject: [PATCH] * extend test for interface helper by tests for "inherited" git-svn-id: trunk@37061 - --- tests/test/tthlp24.pp | 48 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/tests/test/tthlp24.pp b/tests/test/tthlp24.pp index 28d9f06ec0..706309a996 100644 --- a/tests/test/tthlp24.pp +++ b/tests/test/tthlp24.pp @@ -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');