fpc/tests/webtbs/tw13890.pp
2009-06-06 14:35:25 +00:00

33 lines
454 B
ObjectPascal

program test_bits;
{$ifdef fpc}{$mode objfpc}{$h+}{$endif}
uses Classes;
var
bits: TBits;
i, j: Integer;
count: Integer;
procedure AllocateSomething;
begin
Inc(count);
end;
begin
bits := TBits.Create;
count := 0;
for i := 0 to 9 do
begin
j := bits.OpenBit;
if j = bits.Size then
begin
AllocateSomething;
bits[j] := True;
end;
end;
bits.Free;
writeln(count);
if count <> 10 then
Halt(1);
end.