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

Test that properties fail correctly #47

Closed
robrix opened this issue Jun 6, 2015 · 5 comments
Closed

Test that properties fail correctly #47

robrix opened this issue Jun 6, 2015 · 5 comments

Comments

@robrix
Copy link
Contributor

robrix commented Jun 6, 2015

The test for exists in #45 is simply returning true. A more interesting property of exists is its failure when something doesn’t exist.

My tests in Assertions do a little trickery (discovered by @ishkawa) to enable testing assertion failures without actually failing its own tests. It would be nice to use something like this to test that properties which don’t hold, fail.

@CodaFi
Copy link
Member

CodaFi commented Jun 6, 2015

Thing is: our ∃ cannot discern the difference between failure and the RNG skipping or not even reaching a value. Until I have a finer-grained understanding of what it means to fail in an existential built into that pull request I wouldn't know what to test.

@robrix
Copy link
Contributor Author

robrix commented Jun 6, 2015

Ok, not a great example. Being able to test property failure correctly in the general case is still useful.

@CodaFi
Copy link
Member

CodaFi commented Jun 6, 2015

Mhm... I'm thinking the existential is only good as a synonym for ¬ ∀ {x} . P x [basically, proving a test case should never hold given elements of x's domain] at this point. If you manage to make anything concrete you know what to do!

@CodaFi
Copy link
Member

CodaFi commented Aug 13, 2015

OK, now that I read this over again Past Me decided talking past you was a productive avenue. He is an idiot, sorry.

So what about this is different from the expectFailure combinator? That XCTFail is invoked at all is an implementation detail of the particular checking strategy the user has chosen for a property, so it may not always be possible to use your kit. Probably could do something like what you have with mapProp et al.

@robrix
Copy link
Contributor Author

robrix commented Aug 13, 2015

Ah, I understand the miscommunication now.

I’m not talking about using SwiftCheck to test the failure of my code’s properties. Instead, I would like for SwiftCheck to verify (via its tests) that if some arbitrary property doesn’t hold, the test fails. And specifically that this should be the case for exists, because the PR only tests that it succeeds when true, not that it fails when false, and the latter property cannot be derived from the former.

@CodaFi CodaFi mentioned this issue Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants