This commit is contained in:
Jonas Maebe 2002-07-29 14:30:22 +00:00
parent 00801d2c76
commit d4b7f1e371
2 changed files with 82 additions and 0 deletions

24
tests/webtbs/tw2031.pp Normal file
View File

@ -0,0 +1,24 @@
program settest;
const
size = 31;
var
testset : set of 0..size;
i : integer;
begin
testset := [];
testset := testset + [0,1,2,3,4];
if testset <> [0,1,2,3,4] then
begin
writeln('add wrong');
halt(1);
end;
testset := testset - [2];
if testset <> [0,1,3,4] then
begin
writeln('sub wrong');
halt(1);
end;
end.

58
tests/webtbs/tw2059.pp Normal file
View File

@ -0,0 +1,58 @@
{$mode tp}
type ProcType = procedure(s:string);
GetProcType = function(s:string;var Proc:ProcType):boolean;
var ProcVar : ProcType;
GetProcVar : GetProcType;
procedure Default(s:string);
begin
writeln('This is Default:',s);
end;
procedure Proc1(s:string);
begin
writeln('This is Proc1:',s);
end;
procedure Proc2(s:string);
begin
writeln('This is Proc2:',s);
end;
function GetProc(s:string;var ProcVar:ProcType):boolean;
begin
if s='Proc1' then begin
ProcVar:=Proc1;
GetProc:=true;
end
else
if s='Proc2' then begin
ProcVar:=Proc2;
GetProc:=true;
end
else begin
ProcVar:=Default;
GetProc:=false;
end;
end;
begin
GetProcVar:=GetProc;
if GetProcVar('Proc1',ProcVar) then
ProcVar('ok')
else
halt(1);
if GetProcVar('Proc2',ProcVar) then
ProcVar('ok')
else
halt(1);
if GetProcVar('xyz',ProcVar) then
halt(1)
else
writeln('ok');
end.