Skip to content

Generate built-in Range #621

@stijnmoreels

Description

@stijnmoreels

Hi! 👋
Was thinking of adding a built-in generator of the System.Range struct, as this would expand the default generator functionality.
Am currently using this:

let range = gen {
  let! min = Gen.choose (0, Int32.MaxValue)
  let! max = Gen.choose (min, Int32.MaxValue)
  return Range (min, max) }

To make sure that the minimum is always lower than the maximum. But, with some additional options, one could include Range.StartAt and Range.EndAt too.

Just a suggestion when using the awesome FsCheck library 😉 .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions