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

t_id 71
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/06/02 01:36:00 47 2024/06/02 06:03:00 0
i386 7 14.0 2024/06/02 01:36:00 47 2024/06/02 05:03:00 0
m68k 1 2.0 2024/06/02 03:55:00 53 2024/06/02 03:55:00 53
sparc 5 10.0 2024/06/02 03:07:00 41 2024/06/02 04:45:00 56
powerpc 1 2.0 2024/06/02 04:10:00 238 2024/06/02 04:10:00 238
x86_64 24 48.0 2024/06/02 01:57:00 22 2024/06/02 06:03:00 0
powerpc64 4 8.0 2024/06/02 04:15:00 53 2024/06/02 04:32:00 57
mips 1 2.0 2024/06/02 04:00:00 47 2024/06/02 04:00:00 47
mipsel 1 2.0 2024/06/02 04:06:00 185 2024/06/02 04:06:00 185
aarch64 4 8.0 2024/06/02 01:46:00 39 2024/06/02 04:26:00 35
sparc64 1 2.0 2024/06/02 05:03:00 0 2024/06/02 05:03:00 0
riscv64 1 2.0 2024/06/02 04:39:00 31 2024/06/02 04:39:00 31
linux 40 80.0 2024/06/02 01:36:00 47 2024/06/02 05:03:00 0
go32v2 3 6.0 2024/06/02 03:45:00 54 2024/06/02 05:03:00 0
solaris 7 14.0 2024/06/02 03:07:00 41 2024/06/02 06:03:00 0
3.3.1 28 56.0 2024/06/02 01:46:00 39 2024/06/02 06:03:00 0
3.2.3 22 44.0 2024/06/02 01:36:00 47 2024/06/02 05:03:00 0

Source:

{
  $Id: tprocvar1.pp,v 1.6 2002/09/07 15:40:49 peter Exp $
  This program tries to test any aspect of procedure variables and related
  stuff in FPC mode
}

{$ifdef go32v2}
uses
   dpmiexcp;
{$endif go32v2}

Type
  TMyRecord = Record
    MyProc1,MyProc2 : Procedure(l : longint);
    MyVar : longint;
  end;

procedure do_error(i : longint);

  begin
     writeln('Error near: ',i);
     halt(1);
  end;

var
   globalvar : longint;

type
   tpoo_rec = record
      procpointer : pointer;
      s : pointer;
   end;

procedure callmethodparam(s : pointer;addr : pointer;param : longint);

  var
     p : procedure(param : longint) of object;

  begin
     tpoo_rec(p).procpointer:=addr;
     tpoo_rec(p).s:=s;
     p(param);
  end;

type
   to1 = object
      constructor init;
      procedure test1;
      procedure test2(l : longint);
      procedure test3(l : longint);virtual;abstract;
   end;

   to2 = object(to1)
     procedure test3(l : longint);virtual;
   end;

 constructor to1.init;

   begin
   end;

 procedure to1.test1;
   var
      p:pointer;
   begin
      // useless only a semantic test
      p:=@to1.test1;
      // this do we use to do some testing
      p:=@to1.test2;
      globalvar:=0;
      callmethodparam(@self,p,1234);
      if globalvar<>1234 then
        do_error(1000);
   end;

 procedure to1.test2(l : longint);

   begin
      globalvar:=l;
   end;

 procedure to2.test3(l : longint);

   begin
      globalvar:=l;
   end;

 procedure testproc(l : longint);

   begin
      globalvar:=l;
   end;

const
   constmethodaddr : pointer = @to1.test2;
   MyRecord : TMyRecord = (
     MyProc1 : @TestProc;
     MyProc2 : @TestProc;
     MyVar : 0;
   );

var
   o1 : to1;
   o2 : to2;
   p : procedure(l : longint) of object;

begin
   { Simple procedure variables }
   writeln('Procedure variables');
   globalvar:=0;
   MyRecord.MyProc1(1234);
   if globalvar<>1234 then
     do_error(2000);
   globalvar:=0;
   MyRecord.MyProc2(4321);
   if globalvar<>4321 then
     do_error(2001);
   writeln('Ok');
   {                                       }
   {  Procedures of objects                }
   {                                       }
   o1.init;
   o2.init;
   writeln('Procedures of objects');
   p:=@o1.test2;
   globalvar:=0;
   p(12);
   if globalvar<>12 then
     do_error(1002);
   writeln('Ok');
   p:=@o2.test3;
   globalvar:=0;
   p(12);
   if globalvar<>12 then
     do_error(1004);
   writeln('Ok');
   {                                       }
   {  Pointers and addresses of procedures }
   {                                       }
   writeln('Getting an address of a method as pointer');
   o1.test1;
   globalvar:=0;
   callmethodparam(@o1,constmethodaddr,34);
   if globalvar<>34 then
     do_error(1001);
   writeln('Ok');
end.
{
  $Log: tprocvar1.pp,v $
  Revision 1.6  2002/09/07 15:40:49  peter
    * old logs removed and tabs fixed

}

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