pub struct Settings { /* private fields */ }Expand description
Configuration for a Hegel test run.
Use builder methods to customize, then pass to [Hegel::settings] or
the settings parameter of #[hegel::test].
In CI environments (detected automatically), the database is disabled and tests are derandomized by default.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn test_cases(self, n: u64) -> Self
pub fn test_cases(self, n: u64) -> Self
Set the number of test cases to run (default: 100).
Sourcepub fn seed(self, seed: Option<u64>) -> Self
pub fn seed(self, seed: Option<u64>) -> Self
Set a fixed seed for reproducibility, or None for random.
Sourcepub fn derandomize(self, derandomize: bool) -> Self
pub fn derandomize(self, derandomize: bool) -> Self
When true, use a fixed seed derived from the test name. Enabled by default in CI.
Sourcepub fn database(self, database: Option<String>) -> Self
pub fn database(self, database: Option<String>) -> Self
Set the database path for storing failing examples, or None to disable.
Sourcepub fn suppress_health_check(
self,
checks: impl IntoIterator<Item = HealthCheck>,
) -> Self
pub fn suppress_health_check( self, checks: impl IntoIterator<Item = HealthCheck>, ) -> Self
Suppress one or more health checks so they do not cause test failure.
Health checks detect common issues like excessive filtering or slow tests. Use this to suppress specific checks when they are expected.
§Example
use hegel::{HealthCheck, Verbosity};
use hegel::generators as gs;
#[hegel::test(suppress_health_check = [HealthCheck::FilterTooMuch, HealthCheck::TooSlow])]
fn my_test(tc: hegel::TestCase) {
let n: i32 = tc.draw(gs::integers());
tc.assume(n > 0);
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more