Test suite results for test file tbs/tb0268.pp

Test run data :

Free Pascal Compiler Test Suite Results

View Test suite results

Please specify search criteria:
File:
Operating system:
Processor:
Version
Date
Submitter
Machine
Comment
Limit
Cond
Category
Only failed tests
Hide skipped tests
List all 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:

Record count: 50

Total = 50

OK=50 Percentage= 100.00

Result type Cat. Count Percentage First date Last Date
Successfully run 50 100.0 2024/10/19 07:29:00 50 2024/10/19 13:36:00 24
i386 3 6.0 2024/10/19 08:55:00 60 2024/10/19 11:13:00 63
m68k 3 6.0 2024/10/19 07:29:00 50 2024/10/19 10:22:00 40
sparc 4 8.0 2024/10/19 08:05:00 45 2024/10/19 11:16:00 40
powerpc 7 14.0 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
arm 1 2.0 2024/10/19 10:03:00 32 2024/10/19 10:03:00 32
x86_64 11 22.0 2024/10/19 08:40:00 45 2024/10/19 13:36:00 24
powerpc64 7 14.0 2024/10/19 08:43:00 65 2024/10/19 11:23:00 69
mips 2 4.0 2024/10/19 09:54:00 35 2024/10/19 10:28:00 38
mipsel 1 2.0 2024/10/19 09:59:00 38 2024/10/19 09:59:00 38
aarch64 5 10.0 2024/10/19 08:33:00 23 2024/10/19 09:57:00 26
sparc64 3 6.0 2024/10/19 08:33:00 120 2024/10/19 10:46:00 141
riscv64 2 4.0 2024/10/19 10:25:00 33 2024/10/19 11:10:00 26
loongarch64 1 2.0 2024/10/19 09:45:00 25 2024/10/19 09:45:00 25
linux 34 68.0 2024/10/19 07:29:00 50 2024/10/19 11:38:00 25
go32v2 2 4.0 2024/10/19 08:55:00 60 2024/10/19 11:13:00 63
solaris 7 14.0 2024/10/19 13:22:00 24 2024/10/19 13:36:00 24
aix 7 14.0 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
3.3.1 28 56.0 2024/10/19 08:05:00 45 2024/10/19 13:26:00 65
3.2.3 22 44.0 2024/10/19 07:29:00 50 2024/10/19 13:36:00 24

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.