DoTest:
PROC [numberOfExtends:
INT, maxNumberOfPages:
INT ] = {
file: File.Handle;
fileFP: File.FP;
propPages: File.PageCount;
props: File.PropertyStorage;
randomStream: Random.RandomStream;
volume: File.Volume;
offset: WORD;
randomStream ← Random.Create[range: 10000, seed: -1] ;
offset ← Random.ChooseInt[randomStream, 1, 1000];
volume ← File.SystemVolume[];
file ← File.Create[volume: volume, size: 30] ;
[fp: fileFP] ← File.Info[file];
[prop: props, nPages: propPages] ← File.GetProperties[file: file];
IF propPages # 1 THEN ERROR;
setProps[file, offset, props, File.wordsPerPage];
file ← NIL;
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
FOR loopCount:
INT
IN [0 .. numberOfExtends)
DO
growAmount: INT;
nowProps: File.PropertyStorage;
nowPropPages: File.PageCount;
nowWords: CARDINAL;
growAmount ← Random.ChooseInt[randomStream, 1, maxNumberOfPages];
file ← File.Open[volume: volume, fp: fileFP];
[prop: nowProps, nPages: nowPropPages] ← File.GetProperties[file: file];
IF nowPropPages # propPages THEN ERROR;
nowWords ← nowPropPages * File.wordsPerPage;
testProps[offset, nowProps, nowWords];
propPages ← propPages + growAmount;
file.SetPropertiesSize[nPages: propPages];
[prop: nowProps, nPages: nowPropPages] ← File.GetProperties[file: file];
IF nowPropPages # propPages THEN ERROR;
setProps[file, offset, nowProps, propPages*File.wordsPerPage];
file ← NIL;
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE];
ENDLOOP;
file ← File.Open[volume: volume, fp: fileFP];
file.Delete[];
};