mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 03:11:00 +02:00
+ added
This commit is contained in:
parent
00801d2c76
commit
d4b7f1e371
24
tests/webtbs/tw2031.pp
Normal file
24
tests/webtbs/tw2031.pp
Normal 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
58
tests/webtbs/tw2059.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user