Test suite results for test file tbs/tb0268.pp

Test run data :

Run ID:
Operating system: linux
Processor: i386
Version: 3.3.1
Fails/OK/Total: 238/9417/9655
Version: 3.3.1
Full version: 3.3.1-15587-g490a8c68ea-unpushed
Comment: -XR/home/muller/sys-root/i386-linux -Xd -Xr/home/muller/sys-root/i386-linux
Machine: cfarm13
Category: 1
SVN revisions: 490a8c68ea:8b7dbb81b1:3f8bbd3b00:2f9ed0576e
Submitter: muller
Date: 2024/04/19 11:03:00
Previous run: 934303
Next run: 935638

Hide skipped tests

Hide successful tests

Test file "tbs/tb0268.pp" information:

t_id 495
t_adddate 2003/10/03
t_result 0
t_knownrunerror 0

Detailed test run results:

tr_idruntr_oktr_skiptr_result
443813569934990TrueFalseSuccessfully run

Record count: 1

No log of 934990.

Source:

{ Old file: tbs0312.pp }
{ Again the problem of local procs inside methods }

{ Program that showss a problem if
  Self is not reloaded in %esi register
  at entry in local procedure inside method }

uses
  objects;

type
{$ifndef FPC}
  sw_integer = integer;
{$endif not FPC}

  PMYObj = ^TMyObj;

  TMyObj = Object(TObject)
    x : longint;
    Constructor Init(ax : longint);
    procedure display;virtual;
    end;

  PMYObj2 = ^TMyObj2;

  TMyObj2 = Object(TMyObj)
    y : longint;
    Constructor Init(ax,ay : longint);
    procedure display;virtual;
    end;

  PMyCollection = ^TMyCollection;

  TMyCollection = Object(TCollection)
    function At(I : sw_integer) : PMyObj;
    procedure DummyThatShouldNotBeCalled;virtual;
    end;

  { TMy is also a TCollection so that
    ShowMy and DummyThatShouldNotBeCalled are at same position in VMT }
  TMy = Object(TCollection)
    Col : PMyCollection;
    MyObj : PMyObj;
    ShowMyCalled : boolean;
    constructor Init;
    destructor Done;virtual;
    procedure ShowAll;
    procedure AddMyObj(x : longint);
    procedure AddMyObj2(x,y : longint);
    procedure ShowMy;virtual;
    end;

  Constructor TMyObj.Init(ax : longint);
    begin
      Inherited Init;
      x:=ax;
    end;

  Procedure TMyObj.Display;
    begin
      Writeln('x = ',x);
    end;

  Constructor TMyObj2.Init(ax,ay : longint);
    begin
      Inherited Init(ax);
      y:=ay;
    end;

  Procedure TMyObj2.Display;
    begin
      Writeln('x = ',x,' y = ',y);
    end;

  Function TMyCollection.At(I : sw_integer) : PMyObj;
    begin
      At:=Inherited At(I);
    end;

  Procedure TMyCollection.DummyThatShouldNotBeCalled;
    begin
      Writeln('This method should never be called');
      Abstract;
    end;

  Constructor TMy.Init;

    begin
      New(Col,Init(5,5));
      MyObj:=nil;
      ShowMyCalled:=false;
    end;

  Destructor TMy.Done;
    begin
      Dispose(Col,Done);
      Inherited Done;
    end;

  Procedure TMy.ShowAll;

      procedure ShowIt(P : pointer);{$ifdef TP}far;{$endif}
        begin
          ShowMy;
          PMyObj(P)^.Display;
        end;
    begin
      Col^.ForEach(@ShowIt);
    end;

  Procedure TMy.ShowMy;
    begin
      if assigned(MyObj) then
        MyObj^.Display;
      ShowMyCalled:=true;
    end;

  Procedure TMy.AddMyObj(x : longint);

    begin
      MyObj:=New(PMyObj,Init(x));
      Col^.Insert(MyObj);
    end;

  Procedure TMy.AddMyObj2(x,y : longint);
    begin
      MyObj:=New(PMyObj2,Init(x,y));
      Col^.Insert(MyObj);
    end;

var
   My : TMy;
begin
   My.Init;
   My.AddMyObj(5);
   My.AddMyObj2(4,3);
   My.AddMyObj(43);
   { MyObj field is now a PMyObj with value 43 }
   My.ShowAll;
   If not My.ShowMyCalled then
     begin
       Writeln('ShowAll does not work correctly');
       Halt(1);
     end;
   My.Done;

end.

Link to SVN view of tbs/tb0268.pp source.