futhark
Safe HaskellNone
LanguageGHC2021

Futhark.Test.Property

Synopsis

Documentation

runPBT :: PBTConfig -> Server -> [PropSpec] -> IORef PBTPhase -> FilePath -> IO [Either PBTFailure PBTOutput] Source #

Run a list of property specifications, returning a list of results. Each result is either a failure with an error message or a success.

data PBTConfig Source #

Configuration for property-based testing. Includes parameters for test case generation, shrinking, and random seed management.

Constructors

PBTConfig 

Fields

  • configNumTests :: Int32

    Number of test cases to run for each property.

  • configMaxSize :: Int64

    Maximum size argument to pass to generators and shrinkers (unless overridden by PropSpec).

  • configSeed :: Word64

    Seed to use for the random number generator (can be overridden by PropSpec).

  • configShrinkTries :: Int

    Number of shrinking attempts to make on userdefined shrinker before giving up and reporting the current candidate as the final counterexample.

Instances

Instances details
Show PBTConfig Source # 
Instance details

Defined in Futhark.Test.Property

Eq PBTConfig Source # 
Instance details

Defined in Futhark.Test.Property

data PBTPhase Source #

Information about the current phase of property-based testing, used for logging and debugging.

Constructors

PBTPhase 

Fields

Instances

Instances details
Show PBTPhase Source # 
Instance details

Defined in Futhark.Test.Property

Eq PBTPhase Source # 
Instance details

Defined in Futhark.Test.Property

data PropSpec Source #

Specification for a property to be tested, including the property entry point and optional generator and shrinker entry points, as well as an optional size parameter.

Constructors

PropSpec 

Fields

  • psProp :: Text

    The property entry point to test.

  • psGen :: Maybe Text

    Optional generator entry point to use instead of the default auto-generator.

  • psShrink :: Maybe Text

    Optional shrinker entry point to use instead of the default auto-shrinker.

  • psSize :: Maybe Int64

    Optional size argument to pass to the generator and shrinker phases (overrides configMaxSize).

Instances

Instances details
Show PropSpec Source # 
Instance details

Defined in Futhark.Test.Property

Eq PropSpec Source # 
Instance details

Defined in Futhark.Test.Property

type PBTOutput = Maybe Text Source #

Output of a property-based test run, which is either a failure with an error message or a success.

type PBTFailure = Text Source #

Failure in property-based testing, represented as an error message. For example a division by zero runtime error.

extractPropSpecs :: Server -> [EntryName] -> IO (Either PBTFailure [PropSpec]) Source #

Extract property specifications from the server by looking for entry points with #[prop(...)] attributes, comparing with the declared list of properties.