proptest/prelude.rs
1//-
2// Copyright 2017, 2018, 2019 The proptest developers
3//
4// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7// option. This file may not be copied, modified, or distributed
8// except according to those terms.
9
10//! Re-exports the most commonly-needed APIs of proptest.
11//!
12//! This module is intended to be wildcard-imported, i.e.,
13//! `use proptest::prelude::*;`. Note that it re-exports the whole crate itself
14//! under the name `prop`, so you don't need a separate `use proptest;` line.
15//!
16//! In addition to Proptest's own APIs, this also reexports a small portion of
17//! the `rand` crate sufficient to easily use `prop_perturb` and other
18//! functionality that exposes random number generators. Please note that this
19//! is will always be a direct reexport; using these in preference to using the
20//! `rand` crate directly will not provide insulation from the upcoming
21//! revision to the `rand` crate.
22
23pub use crate::arbitrary::{any, any_with, Arbitrary};
24pub use crate::strategy::{BoxedStrategy, Just, SBoxedStrategy, Strategy};
25pub use crate::test_runner::Config as ProptestConfig;
26pub use crate::test_runner::TestCaseError;
27pub use crate::{
28 prop_assert, prop_assert_eq, prop_assert_ne, prop_assume, prop_compose,
29 prop_oneof, proptest,
30};
31
32pub use rand::{Rng, RngCore};
33
34/// Re-exports the entire public API of proptest so that an import of `prelude`
35/// allows simply writing, for example, `prop::num::i32::ANY` rather than
36/// `proptest::num::i32::ANY` plus a separate `use proptest;`.
37pub mod prop {
38 pub use crate::arbitrary;
39 pub use crate::array;
40 pub use crate::bits;
41 pub use crate::bool;
42 pub use crate::char;
43 pub use crate::collection;
44 pub use crate::num;
45 pub use crate::option;
46 pub use crate::result;
47 pub use crate::sample;
48 pub use crate::strategy;
49 #[cfg(feature = "std")]
50 pub use crate::string;
51 pub use crate::test_runner;
52 pub use crate::tuple;
53}