Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed test percentage #436

Open
pashadia opened this issue Mar 22, 2024 · 1 comment
Open

Failed test percentage #436

pashadia opened this issue Mar 22, 2024 · 1 comment
Labels
feature-request This issue is requesting new functionality

Comments

@pashadia
Copy link

Hi all, congrats on a great project!

I'm working on a project which handles a lot of random data, mostly generated from various rand_distr distributions. I would like to implement something like property-based testing, but the particularities of my project allow very few assertions that should be true in all cases. There are a lot more things that "should" hold true in >x% of the cases, but not in 100%.

For instance:

#[cfg(test)]
mod tests {
    use proptest::prelude::*;
    use rand::rngs::mock::StepRng;

    proptest! {
        #[test]
        fn test_random_thing(initial:u64, step:u64) {
            let rng = &mut StepRng::new(initial, step);
            let thing = generate_thing(rng);

            prop_assert!(......);
        }
    }
}

Is there any way to specify that the test assertion should hold true for, e.g. at least 80% of the cases? Would this even be part of what proptest is trying to do?

I would gladly try my hand at an implementation, if this would be accepted as a feature, but doesn't exist yet.

@tzemanovic
Copy link
Contributor

See #34

@matthew-russo matthew-russo added the feature-request This issue is requesting new functionality label Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue is requesting new functionality
Projects
None yet
Development

No branches or pull requests

3 participants