proptest/prelude.rs
1//-
2// Copyright 2017, 2018, 2019, 2026 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 and will always be a direct reexport; using these in preference to using the
20//! `rand` crate directly will not provide insulation from rand API changes.
21
22pub use crate::arbitrary::{any, any_with, Arbitrary};
23pub use crate::strategy::{BoxedStrategy, Just, SBoxedStrategy, Strategy};
24pub use crate::test_runner::Config as ProptestConfig;
25pub use crate::test_runner::{TestCaseError, ProptestResultExt};
26pub use crate::{
27 prop_assert, prop_assert_eq, prop_assert_ne, prop_assume, prop_compose,
28 prop_oneof, proptest,
29};
30
31pub use rand::{Rng, RngExt};
32#[allow(deprecated)]
33pub use rand::rand_core::RngCore;
34
35/// Re-exports the entire public API of proptest so that an import of `prelude`
36/// allows simply writing, for example, `prop::num::i32::ANY` rather than
37/// `proptest::num::i32::ANY` plus a separate `use proptest;`.
38pub mod prop {
39 pub use crate::arbitrary;
40 pub use crate::array;
41 pub use crate::bits;
42 pub use crate::bool;
43 pub use crate::char;
44 pub use crate::collection;
45 pub use crate::num;
46 pub use crate::option;
47 pub use crate::result;
48 pub use crate::sample;
49 pub use crate::strategy;
50 #[cfg(feature = "std")]
51 pub use crate::string;
52 pub use crate::test_runner;
53 pub use crate::tuple;
54}