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

Check invariants for all operations #449

Closed
treeowl opened this issue May 3, 2022 · 9 comments
Closed

Check invariants for all operations #449

treeowl opened this issue May 3, 2022 · 9 comments
Labels

Comments

@treeowl
Copy link
Collaborator

treeowl commented May 3, 2022

We now check invariants for intersections. We should do it for everything else too. containers generally integrates validity tests into other correctness tests (i.e., is the result valid and does it satisfy the other expected properties). That wouldn't be a bad approach to emulate.

@sjakobi sjakobi added the tests label May 3, 2022
@sjakobi
Copy link
Member

sjakobi commented May 3, 2022

containers generally integrates validity tests into other correctness tests (i.e., is the result valid and does it satisfy the other expected properties).

What does this look like in practice? Do you have a link?

@treeowl
Copy link
Collaborator Author

treeowl commented May 3, 2022

It varies somewhat by module, and I don't know that the design is wonderful. Would it be so bad to just add valid result .&&. to each test?

@sjakobi
Copy link
Member

sjakobi commented May 4, 2022

I don't know whether it would be so bad, but my preference is to have separate validation tests. I think that would make it easier to see whether such a test exists for a given function or not. In containers, the existence of these tests doesn't seem obvious in many cases.

@treeowl
Copy link
Collaborator Author

treeowl commented May 4, 2022

My concern with separate tests is performance. I'd much rather have enough time to run, say, 20×(property+validation) tests than 15×property+15×validation, or whatever it comes out to. Generation isn't free, and neither are intersections, unions, etc. I agree that the way it's handled in containers isn't optimal for clarity; can we do better?

@sjakobi
Copy link
Member

sjakobi commented May 4, 2022

Where are these performance concerns coming from? Currently, the entire test suite takes about 1s to run for me. 1.6s with -O0. If it ends up taking 3s, would that be a problem for you?

@treeowl
Copy link
Collaborator Author

treeowl commented May 4, 2022

Wow ... that's ... surprising. To my mind, such fast runs means our examples are too small or there aren't enough of them.

@sjakobi
Copy link
Member

sjakobi commented May 4, 2022

Wow ... that's ... surprising. To my mind, such fast runs means our examples are too small or there aren't enough of them.

Maybe. In my experience test suites of Haskell packages often are quite speedy. The bytestring test suite, which is quite a bit larger than u-c's takes 2s for me for example.

@sjakobi sjakobi mentioned this issue May 4, 2022
2 tasks
@treeowl
Copy link
Collaborator Author

treeowl commented May 4, 2022

I haven't looked at the test suite recently. Are we getting coverage of enough tree shapes and heights, ignoring the Full issue?

@sjakobi
Copy link
Member

sjakobi commented May 4, 2022

I haven't looked at the test suite recently. Are we getting coverage of enough tree shapes and heights, ignoring the Full issue?

That was the goal with #442. I'm fairly confident about the test generators. But feel free to investigate.

sjakobi added a commit that referenced this issue May 6, 2022
@sjakobi sjakobi closed this as completed in 008c345 May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants