Test suite results for test file test/tobject1.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 "test/tobject1.pp" information:

t_id 64
t_adddate 2003/10/03
t_result 210
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/05/17 23:52:00 41 2024/05/18 01:29:00 0
i386 33 66.0 2024/05/18 00:20:00 23 2024/05/18 01:29:00 0
sparc 1 2.0 2024/05/17 23:52:00 41 2024/05/17 23:52:00 41
x86_64 12 24.0 2024/05/18 00:10:00 29 2024/05/18 01:29:00 0
powerpc64 2 4.0 2024/05/18 01:09:00 101 2024/05/18 01:11:00 108
aarch64 2 4.0 2024/05/18 00:11:00 33 2024/05/18 00:52:00 35
linux 38 76.0 2024/05/18 00:11:00 33 2024/05/18 01:29:00 0
win32 1 2.0 2024/05/18 00:21:00 24 2024/05/18 00:21:00 24
solaris 11 22.0 2024/05/17 23:52:00 41 2024/05/18 00:34:00 30
3.3.1 19 38.0 2024/05/18 00:11:00 33 2024/05/18 01:29:00 0
3.2.3 31 62.0 2024/05/17 23:52:00 41 2024/05/18 01:29:00 0

Source:

{ %RESULT=210 }
{$R+}

program test_fail;

  type
     parrayobj = ^tarrayobj;
     tarrayobj = object
       ar : array [1..4] of real;
       constructor init(do_fail : boolean);
       procedure test;virtual;
       destructor done;virtual;
       end;
     pbigarrayobj = ^tbigarrayobj;
     tbigarrayobj = object(tarrayobj)
       ar2 : array [1..10000] of real;
       constructor good_init;
       constructor wrong_init;
       procedure test;virtual;
       end;
  var
    pa1, pa2 : parrayobj;
    ta1, ta2 : tarrayobj;
    availmem : longint;

  constructor tarrayobj.init(do_fail : boolean);
    begin
       ar[1]:=1;
       if do_fail then
         fail;
       ar[2]:=2;
    end;

  destructor tarrayobj.done;
    begin
    end;

  procedure  tarrayobj.test;
    begin
      Writeln('@self = ',longint(@self));
      Writeln('typeof = ',longint(typeof(self)));
      if ar[1]=1 then
        Writeln('Init called');
      if ar[2]=2 then
        Writeln('Init successful');
    end;

  constructor tbigarrayobj.good_init;
    begin
      inherited init(false);
      Writeln('End of tbigarrayobj.good_init');
    end;

  constructor tbigarrayobj.wrong_init;
    begin
      inherited init(true);
      Writeln('End of tbigarrayobj.wrong_init');
    end;

  procedure tbigarrayobj.test;
    begin
      Writeln('tbigarrayobj.test called');
      Inherited test;
    end;

  begin
     availmem:=memavail;
     new(pa1,init(false));
     writeln('After successful new(pa1,init), memory used = ',availmem - memavail);
     new(pa2,init(true));
     writeln('After unsuccessful new(pa2,init), memory used = ',availmem - memavail);
     writeln('pa1 = ',longint(pa1),' pa2 = ',longint(pa2));
     writeln('Call to pa1^.test after successful init');
     pa1^.test;
     dispose(pa1,done);
     writeln('After release of pa1, memory used = ',availmem - memavail);
     pa1:=new(pbigarrayobj,good_init);
     writeln('After successful pa1:=new(pbigarrayobj,good_init), memory used = ',availmem - memavail);
     pa2:=new(pbigarrayobj,wrong_init);
     writeln('After unsuccessful pa2:=new(pbigarrayobj,wrong_init), memory used = ',availmem - memavail);
     writeln('pa1 = ',longint(pa1),' pa2 = ',longint(pa2));
     writeln('Call to pa1^.test after successful init');
     pa1^.test;
     ta1.init(false);
     writeln('Call to ta1.test after successful init');
     ta1.test;
     ta2.init(true);
     writeln('typeof(ta2) = ',longint(typeof(ta2)),' after unsuccessful init');
     Writeln('Trying to call ta2.test (should generate a Run Time Error)');
     ta2.test;
  end.

Link to SVN view of test/tobject1.pp source.