Fix interesting case identification for properties expected to fail.

This commit is contained in:
KtorZ 2024-03-04 23:28:45 +01:00
parent 4097d1edb2
commit 4d432513e0
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 5 additions and 1 deletions

View File

@ -485,9 +485,13 @@ impl<'a> Counterexample<'a> {
Some((_, value)) => {
let result = self.property.eval(&value);
let is_failure = result.failed(self.property.can_error);
let expect_failure = self.property.can_error;
// If the test no longer fails, it isn't better as we're only
// interested in counterexamples.
if !result.failed(self.property.can_error) {
if (expect_failure && is_failure) || (!expect_failure && !is_failure) {
return false;
}