Browse Source

* extend test for interface helper by tests for "inherited"

git-svn-id: trunk@37061 -
svenbarth 8 years ago
parent
commit
ec7a17d1e3
1 changed files with 44 additions and 4 deletions
  1. 44 4
      tests/test/tthlp24.pp

+ 44 - 4
tests/test/tthlp24.pp

@@ -34,11 +34,16 @@ type
     function Blubb: LongInt;
     function Blubb: LongInt;
     function Foobar(aArg: LongInt): LongInt; overload;
     function Foobar(aArg: LongInt): LongInt; overload;
     function Test: LongInt;
     function Test: LongInt;
+    function Calculate: LongInt;
+    function CalculateBase: LongInt;
     class function TestStatic: LongInt; static;
     class function TestStatic: LongInt; static;
   end;
   end;
 
 
   TTestIntfSubSubHelper = type helper(TTestIntfHelper) for ITestIntfSubSub
   TTestIntfSubSubHelper = type helper(TTestIntfHelper) for ITestIntfSubSub
     function SomethingElse: LongInt;
     function SomethingElse: LongInt;
+    function Calculate: LongInt;
+    function CalculateBase: LongInt;
+    function CalculateBase2: LongInt;
   end;
   end;
 
 
 { TTestSubSub }
 { TTestSubSub }
@@ -62,6 +67,21 @@ begin
   Result := 7;
   Result := 7;
 end;
 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 }
 { TTest }
 
 
 function TTest.Blubb: LongInt;
 function TTest.Blubb: LongInt;
@@ -91,6 +111,16 @@ begin
   Result := 1;
   Result := 1;
 end;
 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;
 class function TTestIntfHelper.TestStatic: LongInt;
 begin
 begin
   Result := 2;
   Result := 2;
@@ -114,20 +144,30 @@ begin
     Halt(5);
     Halt(5);
   if i.Foobar(6) <> 6 then
   if i.Foobar(6) <> 6 then
     Halt(6);
     Halt(6);
+  if i.Calculate <> 35 then
+    Halt(7);
+  if i.CalculateBase <> 45 then
+    Halt(8);
   i := Nil;
   i := Nil;
 
 
   _is := TTestSub.Create;
   _is := TTestSub.Create;
   if _is.Blubb <> 3 then
   if _is.Blubb <> 3 then
-    Halt(7);
+    Halt(9);
   if _is.Foobar(8) <> 8 then
   if _is.Foobar(8) <> 8 then
-    Halt(8);
+    Halt(10);
   _is := Nil;
   _is := Nil;
 
 
   iss := TTestSubSub.Create;
   iss := TTestSubSub.Create;
   if iss.SomethingElse <> 7 then
   if iss.SomethingElse <> 7 then
-    Halt(9);
+    Halt(11);
   if iss.Blubb <> 3 then
   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;
   iss := Nil;
 
 
   Writeln('ok');
   Writeln('ok');