-
proptest::char::ANY
replaced withproptest::char::any()
.proptest::char::ANY
is present but deprecated, and will be removed in proptest 0.5.0. -
Instead of returning
-> Result<Self::Value, String>
, strategies are expected to return-> Result<Self::Value, Reason>
instead.Reason
reduces the amount of heap allocations, especially for.prop_filter(..)
where you may now also pass in&'static str
. You will only experience breaks if you've written your own strategy types or if you've usedTestCaseError::Reject
orTestCaseError::Fail
explicitly. -
Update of externally-visible crate
rand
to0.4.2
.
-
Added
proptest::test_runner::Reason
which allows you to avoid heap allocation in some places and may be used to make the API richer in the future without incurring more breaking changes. -
Added a type alias
proptest::strategy::NewTree<S>
whereS: Strategy
defined as:type NewTree<S> = Result<<S as Strategy>::Value, Rejection>
.
- Cases where
file!()
returns a relative path, such as on Windows, are now handled more reasonably. See #24 for more details and instructions on how to migrate any persistence files that had been written to the wrong location.
Boxing Day Special
-
Added support for
i128
andu128
. Since this is an unstable feature in Rust, this is hidden behind the featureunstable
which you have to explicitly opt into in yourCargo.toml
file. -
Failing case persistence. By default, when a test fails, Proptest will now save the seed for the failing test to a file, and later runs will test the persisted failing cases before generating new ones.
-
Added
UniformArrayStrategy
and helper functions to simplify generating homogeneous arrays with non-Copy
inner strategies. -
Trait
rand::Rng
and structrand::XorShiftRng
are now included inproptest::prelude
.
- Fix a case where certain combinations of strategies, like two
prop_shuffle()
s in close proximity, could result in low-quality randomness.
-
Added
SampledBitSetStrategy
to generate bit sets based on size distribution. -
Added
Strategy::sboxed()
andSBoxedStrategy
to makeSend + Sync
boxed strategies. -
RegexGeneratorStrategy
is nowSend
andSync
. -
Added a type alias
ValueFor<S>
whereS: Strategy
. This is a shorter way to refer to:<<S as Strategy>::Value as ValueTree>::Value
. -
Added a type alias
type W<T> = (u32, T)
for a weighted strategyT
in the context of union strategies. -
TestRunner
now implementsDefault
. -
Added
Config::with_cases(number_of_cases: u32) -> Config
for simpler construction of aConfig
that only differs by the number of test cases. -
All default fields of
Config
can now be overridden by setting environment variables. See the docs of that struct for more details. -
Bumped dependency
rand = "0.3.18"
. -
Added
proptest::sample::subsequence
which returns a strategy generating subsequences, of the sourceVec
, with a size within the givenRange
. -
Added
proptest::sample::select
which returns a strategy selecting exactly one value from another collection. -
Added
prop_perturb
strategy combinator. -
Added
strategy::check_strategy_sanity()
function to do sanity checks on the shrinking implementation of a strategy. -
Added
prop_shuffle
strategy combinator. -
Added
strategy::Fuse
adaptor.
-
Fix bug where
Vec
, array and tuple shrinking could corrupt the state of their inner values, for example leading to out-of-range integers. -
Fix bug where
Flatten
(a.k.a. theprop_flat_map
combinator) could fail to converge to a failing test case during shrinking. -
Fix
TupleUnion
sometimes panicking during shrinking if there were more than two choices.
- Added
CharStrategy::new_borrowed
.
-
Union
now supports weighting viaUnion::new_weighted
. Corresponding syntax to specify weights is also available inprop_oneof!
. -
Added
TupleUnion
, which works likeUnion
but permits doing static dispatch even with heterogeneous delegate strategies. -
prop_oneof!
is smarter about how it combines the input strategies. -
Added
option
module to generate weighted or unweightedOption
types. -
Added
result
module to generate weighted or unweightedResult
types. -
All
bits
submodules now have amasked
function to create a strategy for generating subsets of an arbitrary bitmask.
-
Union::new
now has a generic argument type which could impact type inference. -
The concrete types produced by
prop_oneof!
have changed. -
API functions which used to return
BoxedStrategy
now return a specific type. -
BitSetStrategy<T>
is no longerCopy
for non-Copy
typesT
norDebug
for non-Debug
typesT
. -
BitSetLike::max
has been renamed toBitSetLike::len
.
-
Added
prop_assert!
macro family to assert without panicking, for quieter test failure modes. -
New
prelude
module for easier importing of important things. -
Renamed
Singleton
toJust
. (The old name is still available.) -
Failure messages produced by
proptest!
are now much more readable. -
Added in-depth tutorial.
Strategy
now requiresstd::fmt::Debug
.
-
Strategy
now has a family ofprop_flat_map()
combinators for producing dynamic and higher-order strategies. -
Strategy
has aprop_recursive()
combinator which allows generating recursive structures. -
Added
proptest::bool::weighted()
to pull booleans from a weighted distribution. -
New
prop_oneof!
macro makes it easier to select from one of several strategies. -
New
prop_compose!
macro to simplify writing most types of custom strategies.
Add strategy::NoShrink
, Strategy::no_shrink()
.