index 393c43cf1c34fae1d27b008cc32eadb419d13de8..32d0fd05540476db2ac05aee79e34808360e057a 100644 (file)
f, n: Integer;
usedIds: Integer = 0;
begin
- ip := TIdPool.Create(65535*1024);
+ ip := TIdPool.Create(65535);
SetLength(map, ip.maxId+1);
for f := 0 to High(map) do map[f] := false;
for f := 0 to High(map) div 2 do
begin
+ while true do
+ begin
+ n := Random(ip.maxId+1);
+ if map[n] then
+ begin
+ if not ip.hasAlloced[n] then raise Exception.Create('invalid pool(0)');
+ if ip.hasFree[n] then raise Exception.Create('invalid pool(1)');
+ continue;
+ end;
+ break;
+ end;
+ if (ip.alloc(n) <> n) then raise Exception.Create('wutafuuuuu?!');
+ map[n] := true;
+ Inc(usedIds);
+ if not ip.hasAlloced[n] then raise Exception.Create('invalid pool(3)');
+ if ip.hasFree[n] then raise Exception.Create('invalid pool(4)');
+ //ip.dump();
+ {
if ip.hasAlloced[f] then raise Exception.Create('invalid pool(0)');
if not ip.hasFree[f] then raise Exception.Create('invalid pool(1)');
if (ip.alloc <> f) then raise Exception.Create('invalid alloc(2)');
Inc(usedIds);
if not ip.hasAlloced[f] then raise Exception.Create('invalid pool(3)');
if ip.hasFree[f] then raise Exception.Create('invalid pool(4)');
+ }
end;
for f := 0 to 10000000 do
begin
if not ip.hasFree[f] then raise Exception.Create('invalid pool(e)');
end;
end;
+ ip.Free();
end;