fpc/tests/test/jvm/testintf.pp
Jonas Maebe 71068ae7eb * made the tests Android-compatible (use the androidr14 unit instead
of the jdk15 unit in that case)
  * adjusted testall.sh script so it can also be used to test class
    files compiled for Android (still with the JVM though)

git-svn-id: branches/jvmbackend@19835 -
2011-12-12 20:34:02 +00:00

79 lines
1.3 KiB
ObjectPascal

{ %norun }
{$mode objfpc}
{$namespace org.freepascal.test}
unit testintf;
interface
type
tinterface1 = interface
function test(l: longint): longint;
end;
tinterface2 = interface
const
iconst = longint(4);
function test(b: byte): longint;
end;
tinterface3 = interface(tinterface1,tinterface2)
end;
tinterface4 = interface
function intf4test(i: int64): longint;
end;
tintfclass = class(tinterface1,tinterface2,tinterface3)
constructor create;
function test(l: longint): longint;virtual;final;
function Test(b: byte): longint;virtual;final;
destructor destroy; override;
end;
tintfclass2 = class(tintfclass,tinterface4)
constructor create;
function intf4test(i: int64): longint;virtual;final;
end;
implementation
uses
{$ifdef java}jdk15{$else}androidr14{$endif};
constructor tintfclass.create;
begin
end;
function tintfclass.Test(l: longint): longint;
begin
result:=l+1;
end;
function tintfclass.test(b: byte): longint;
begin
result:=b+2;
end;
destructor tintfclass.destroy;
begin
JLSystem.fout.println(555);
end;
constructor tintfclass2.create;
begin
end;
function tintfclass2.intf4test(i: int64): longint;
begin
result:=i div 12345;
end;
end.