API Reference | fast-check | Property based testing framework
    Preparing search index...

    Function statistics

    • Gather useful statistics concerning generated values

      Print the result in console.log or params.logger (if defined)

      Type Parameters

      • Ts

      Parameters

      • generator: IRawProperty<Ts, boolean> | Arbitrary<Ts>

        IProperty or Arbitrary to extract the values from

      • classify: (v: Ts) => string | string[]

        Classifier function that can classify the generated value in zero, one or more categories (with free labels)

      • Optionalparams: number | Parameters<Ts>

        Integer representing the number of values to generate or Parameters as in assert

      Returns void

      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

      Since 0.0.6