Zafu/Testing/HedgeHog

Zafu/Testing/HedgeHog

source code:

public dependencies: Zafu/Abstract/Applicative, Zafu/Abstract/Monad, Zafu/Collection/LazyTree, Zafu/Testing/HedgeHog/Seed, Zafu/Testing/HedgeHog/Size

Index

Types

Gen[a]

HedgeHog generator with shrink tree threaded through Size and Seed.

type Gen[a: +*]

Prop

HedgeHog property that expands into a Test after sampling.

type Prop

Values

ascii_char_Gen

Generator for printable ASCII characters.

references: Char, Gen

ascii_char_Gen: Gen[Char]

bool_Gen

Generator for Bool values.

references: Bool, Gen

bool_Gen: Gen[Bool]

char_Gen

Generator that mixes ASCII and multibyte UTF-8 characters.

references: Char, Gen

char_Gen: Gen[Char]

comparison_Gen

Generator for LT, EQ, and GT values.

references: Comparison, Gen

comparison_Gen: Gen[Comparison]

const_Gen

Build a generator that always returns the same value.

references: Gen

def const_Gen[a](value: a) -> Gen[a]

exact_list_Gen

references: Gen, Int, List

def exact_list_Gen[a](length: Int, gen: Gen[a]) -> Gen[List[a]]

fixed_size_Gen

Override the size seen by a generator.

references: Gen, Zafu/Testing/HedgeHog/Size::Size

def fixed_size_Gen[a](gen: Gen[a], fixed_size: Zafu/Testing/HedgeHog/Size::Size) -> Gen[a]

flat_map_Gen

Sequence generators while threading size, seed, and shrink trees.

references: Gen

def flat_map_Gen[a, b](gen: Gen[a], fn: a -> Gen[b]) -> Gen[b]

float64_Gen

Generator for finite Float64 values with basic shrinking.

references: Float64, Gen

float64_Gen: Gen[Float64]

forall_Prop

Common-case property builder with default sample rendering.

references: Gen, Prop, String, Test

def forall_Prop[a](gen: Gen[a], name: String, test_fn: a -> Test) -> Prop

forall_True_Prop

references: Bool, Gen, Prop, String

def forall_True_Prop[a](gen: Gen[a], name: String, show: a -> String, fn: a -> Bool) -> Prop

forall_show_Prop

Build a property by testing generated values and shrinking failures.

references: Gen, Prop, String, Test

def forall_show_Prop[a](gen: Gen[a], name: String, show: a -> String, test_fn: a -> Test) -> Prop

geometric_Int_Gen

Generator for non-negative Int values with geometric distribution by mean.

references: Float64, Gen, Int

def geometric_Int_Gen(mean: Float64) -> Gen[Int]

int32_Gen

Generator focused on 32-bit signed Int values.

references: Gen, Int

int32_Gen: Gen[Int]

int_Gen

Generator for signed Int values across several size-scaled ranges.

references: Gen, Int

int_Gen: Gen[Int]

int_between_Gen

Generator for Int values in [low, high), clamped to low when high <= low.

references: Gen, Int

def int_between_Gen(low: Int, high_exclusive: Int) -> Gen[Int]

int_range_Gen

Generator for Int values in [0, upper), clamped to 0 when upper <= 0.

references: Gen, Int

def int_range_Gen(upper: Int) -> Gen[Int]

list_Gen

Generator for short lists of generated values.

references: Gen, List

def list_Gen[a](gen: Gen[a]) -> Gen[List[a]]

map2_Gen

references: Gen

def map2_Gen[a, b, c](left: Gen[a], right: Gen[b], fn: (a, b) -> c) -> Gen[c]

map_Gen

Map over generated values without changing the shrink structure.

references: Gen

def map_Gen[a, b](gen: Gen[a], to: a -> b) -> Gen[b]

monad_Gen

references: Gen, Zafu/Abstract/Monad::Monad

monad_Gen: Zafu/Abstract/Monad::Monad[Gen]

no_shrink_Gen

Lift a sampler with no shrink candidates into a generator.

references: Gen, Tuple2, Zafu/Testing/HedgeHog/Seed::Seed, Zafu/Testing/HedgeHog/Size::Size

def no_shrink_Gen[a](
    run_value: (Zafu/Testing/HedgeHog/Size::Size, Zafu/Testing/HedgeHog/Seed::Seed) -> (Zafu/Testing/HedgeHog/Seed::Seed, a)
) -> Gen[a]

option_Gen

Lift a generator into Option, including None as a shrink candidate.

references: Gen, Option

def option_Gen[a](gen: Gen[a]) -> Gen[Option[a]]

pos_Int_Gen

Generator for positive Int values.

references: Gen, Int

pos_Int_Gen: Gen[Int]

product_applicative_Gen

Product applicative using map2_Gen's paired shrink trees. This generally shrinks better for independent products, but it is not the Applicative aligned with flat_map_Gen / monad_Gen because map2_Gen does not preserve the same left-to-right sequencing semantics.

references: Gen, Zafu/Abstract/Applicative::Applicative

product_applicative_Gen: Zafu/Abstract/Applicative::Applicative[Gen]

run_Gen

Run a generator at a specific size and seed.

references: Gen, Tuple2, Zafu/Collection/LazyTree::LazyTree, Zafu/Testing/HedgeHog/Seed::Seed, Zafu/Testing/HedgeHog/Size::Size

def run_Gen[a
](gen: Gen[a], size: Zafu/Testing/HedgeHog/Size::Size, seed: Zafu/Testing/HedgeHog/Seed::Seed) -> Zafu/Collection/LazyTree::LazyTree[(Zafu/Testing/HedgeHog/Seed::Seed, a)]

run_Prop

Run a property with a sample count and integer seed.

references: Int, Prop, Test

def run_Prop(prop: Prop, count: Int, seed: Int) -> Test

scale_Gen

Transform the size before running a generator.

references: Gen, Zafu/Testing/HedgeHog/Size::Size

def scale_Gen[a
](gen: Gen[a], scale: Zafu/Testing/HedgeHog/Size::Size -> Zafu/Testing/HedgeHog/Size::Size) -> Gen[a]

sequence_Gen

Sequence a list of generators into a generator of lists.

references: Gen, List

def sequence_Gen[a](gens: List[Gen[a]]) -> Gen[List[a]]

short_ascii_Gen

Generator for short printable ASCII strings.

references: Gen, String

short_ascii_Gen: Gen[String]

smaller_Gen

Run a generator at a smaller, golden-ratio-scaled size.

references: Gen

def smaller_Gen[a](gen: Gen[a]) -> Gen[a]

string_Gen

Generator for short strings with mixed ASCII/UTF-8 chars.

references: Gen, String

string_Gen: Gen[String]

suite_Prop

Group several properties under a named test suite.

references: List, Prop, String

def suite_Prop(name: String, props: List[Prop]) -> Prop

traverse_Gen

Traverse a list with a generator-producing function.

references: Gen, List

def traverse_Gen[a, b](items: List[a], fn: a -> Gen[b]) -> Gen[List[b]]

tuple2_Gen

Combine two generators into a generator for pairs.

references: Gen, Tuple2

def tuple2_Gen[a, b](left: Gen[a], right: Gen[b]) -> Gen[(a, b)]

tuple3_Gen

Combine three generators into a generator for triples.

references: Gen, Tuple3

def tuple3_Gen[a, b, c](ga: Gen[a], gb: Gen[b], gc: Gen[c]) -> Gen[(a, b, c)]

tuple4_Gen

Combine four generators into a generator for 4-tuples.

references: Gen, Tuple4

def tuple4_Gen[a, b, c, d](ga: Gen[a], gb: Gen[b], gc: Gen[c], gd: Gen[d]) -> Gen[(a, b, c, d)]

uint32_Gen

Generator for non-negative 32-bit unsigned-like Int values.

references: Gen, Int

uint32_Gen: Gen[Int]

unit_Float64_Gen

references: Float64, Gen

unit_Float64_Gen: Gen[Float64]

unit_Gen

Generator for Unit.

references: Gen, Unit

unit_Gen: Gen[()]

with_bounded_uint32_Gen

Pair generated values with an independent bounded Int derived from the value.

references: Gen, Int, Tuple2

def with_bounded_uint32_Gen[a](base: Gen[a], upper: a -> Int, shift: Int) -> Gen[(a, Int)]