Function: statistics()
statistics<
Ts>(generator,classify,params?):void
Defined in: packages/fast-check/src/check/runner/Sampler.ts:95
Gather useful statistics concerning generated values
Print the result in console.log or params.logger (if defined)
Type Parameters
| Type Parameter |
|---|
Ts |
Parameters
| Parameter | Type | Description |
|---|---|---|
generator | IRawProperty<Ts, boolean> | Arbitrary<Ts> | IProperty or Arbitrary to extract the values from |
classify | (v) => string | string[] | Classifier function that can classify the generated value in zero, one or more categories (with free labels) |
params? | number | Parameters<Ts> | Integer representing the number of values to generate or Parameters as in assert |
Returns
void
Example
fc.statistics(
fc.nat(999),
v => v < 100 ? 'Less than 100' : 'More or equal to 100',
{numRuns: 1000, logger: console.log});
// Classify 1000 values generated by fc.nat(999) into two categories:
// - Less than 100
// - More or equal to 100
// The output will be sent line by line to the logger
Remarks
Since 0.0.6