mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 22:49:34 +02:00
33 lines
454 B
ObjectPascal
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.
|