Categorygithub.com/leanovate/gopter
modulepackage
0.2.11
Repository: https://github.com/leanovate/gopter.git
Documentation: pkg.go.dev

# README

GOPTER

... the GOlang Property TestER Build Status codecov GoDoc Go Report Card

Change Log

Synopsis

Gopter tries to bring the goodness of ScalaCheck (and implicitly, the goodness of QuickCheck) to Go. It can also be seen as a more sophisticated version of the testing/quick package.

Main differences to ScalaCheck:

  • It is Go ... duh
  • ... nevertheless: Do not expect the same typesafety and elegance as in ScalaCheck.
  • For simplicity Shrink has become part of the generators. They can still be easily changed if necessary.
  • There is no Pretty ... so far gopter feels quite comfortable being ugly.
  • A generator for regex matches
  • No parallel commands ... yet?

Main differences to the testing/quick package:

  • Much tighter control over generators
  • Shrinkers, i.e. automatically find the minimum value falsifying a property
  • A generator for regex matches (already mentioned that ... but it's cool)
  • Support for stateful tests

Documentation

Current godocs:

  • gopter: Main interfaces
  • gopter/gen: All commonly used generators
  • gopter/prop: Common helpers to create properties from a condition function and specific generators
  • gopter/arbitrary: Helpers automatically combine generators for arbitrary types
  • gopter/commands: Helpers to create stateful tests based on arbitrary commands
  • gopter/convey: Helpers used by gopter inside goconvey tests

License

MIT Licence

# Packages

Package arbitrary contains helpers to create contexts of arbitrary values, i.e.
Package commands contains helpers to create stateful tests based on commands.
Package gen contains all commonly used generators and shrinkers.
Package prop contains the most common implementations of a gopter.Prop.

# Functions

CombineGens creates a generators from a list of generators.
CombineShrinker create a shrinker by combining a list of shrinkers.
ConcatShrinks concats an array of shrinks to a single shrinks.
ConsoleReporter creates a FormatedReporter writing to the console (i.e.
DefaultGenParameters creates default GenParameters.
DefaultTestParameterWithSeeds creates reasonable default Parameters for most cases with an undefined RNG-seed.
DefaultTestParameterWithSeeds creates reasonable default Parameters for most cases based on a fixed RNG-seed.
DeriveGen derives a generator with shrinkers from a sequence of other generators mapped by a bijective function (BiMapper).
MinGenParameters creates minimal GenParameters.
NewBiMapper creates a BiMapper of two functions `downstream` and its inverse `upstream`.
NewEmptyResult creates an empty generator result.
NewFormatedReporter create a new formated reporter verbose toggles verbose output of the property results width is the maximal width per line output is the writer were the report will be written to.
NewGenResult creates a new generator result from for a concrete value and shrinker.
NewLockedSource takes a seed and returns a new lockedSource for use with rand.New.
NewPropArg creates a new PropArg.
NewProperties create new Properties with given test parameters.
NewPropResult create a PropResult with label.
SaveProp creates s save property by handling all panics from an inner property.

# Constants

PropError The property has generated an error.
PropFalse The property was false this time.
PropProof THe property was proved (i.e.
PropTrue The property was true this time.
PropUndecided The property has no clear outcome this time.
TestError indicates that the property check has finished with an error.
TestExhausted indicates that the property check has exhausted, i.e.
TestFailed indicates that the property check has failed.
TestPassed indicates that the property check has passed.
TestProved indicates that the property has been proved.

# Variables

DefaultGenParams can be used as default für *GenParameters.
No description provided by the author
NoShrink is an empty shrink.
NoShrinker is a shrinker for NoShrink, i.e.

# Structs

BiMapper is a bi-directional (or bijective) mapper of a tuple of values (up) to another tuple of values (down).
Flag is a convenient helper for an atomic boolean.
FormatedReporter reports test results in a human readable manager.
GenParameters encapsulates the parameters for all generators.
GenResult contains the result of a generator.
PropArg contains information about the specific values for a certain property check.
Properties is a collection of properties that should be checked in a test.
PropResult contains the result of a property.
TestParameters to run property tests.
TestResult contains the result of a property property check.

# Interfaces

Reporter is a simple interface to report/format the results of a property check.

# Type aliases

Gen generator of arbitrary values.
Prop represent some kind of property that (drums please) can and should be checked.
PropArgs is a list of PropArg.
Shrink is a stream of shrunk down values.
Shrinker creates a shrink for a given value.