~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/tests/test/tclass5.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{ %RESULT=210 }
 
2
{$R+}
 
3
 
 
4
{$mode objfpc}
 
5
 
 
6
program test_fail;
 
7
 
 
8
  type
 
9
     parrayobj = ^tarraycla;
 
10
     tarraycla = class
 
11
       ar : array [1..4] of real;
 
12
       constructor create(do_fail : boolean);
 
13
       procedure test;virtual;
 
14
       destructor done;virtual;
 
15
       end;
 
16
     pbigarrayobj = ^tbigarraycla;
 
17
     tbigarraycla = class(tarraycla)
 
18
       ar2 : array [1..10000] of real;
 
19
       constructor good_init;
 
20
       constructor wrong_init;
 
21
       procedure test;virtual;
 
22
       end;
 
23
  var
 
24
    ta1, ta2 : tarraycla;
 
25
 
 
26
  constructor tarraycla.create(do_fail : boolean);
 
27
    begin
 
28
       ar[1]:=1;
 
29
       if do_fail then
 
30
         fail;
 
31
       ar[2]:=2;
 
32
    end;
 
33
 
 
34
  destructor tarraycla.done;
 
35
    begin
 
36
    end;
 
37
 
 
38
  procedure  tarraycla.test;
 
39
    begin
 
40
      if ar[1]=1 then
 
41
        Writeln('Init called');
 
42
      if ar[2]=2 then
 
43
        Writeln('Init successful');
 
44
    end;
 
45
 
 
46
  constructor tbigarraycla.good_init;
 
47
    begin
 
48
      inherited create(false);
 
49
      Writeln('End of tbigarraycla.good_init');
 
50
    end;
 
51
 
 
52
  constructor tbigarraycla.wrong_init;
 
53
    begin
 
54
      inherited create(true);
 
55
      Writeln('End of tbigarraycla.wrong_init');
 
56
    end;
 
57
 
 
58
  procedure tbigarraycla.test;
 
59
    begin
 
60
      Writeln('tbigarraycla.test called');
 
61
      Inherited test;
 
62
    end;
 
63
 
 
64
  begin
 
65
     ta1:=tarraycla.create(false);
 
66
     writeln('Call to ta1.test after successful init');
 
67
     ta1.test;
 
68
     ta2:=tarraycla.create(true);
 
69
     writeln('ta2 = ',ptrint(ta2),' after unsuccessful init');
 
70
     Writeln('Trying to call ta2.test (should generate a Run Time Error)');
 
71
     ta2.test;
 
72
  end.