chrono
chrono copied to clipboard
Optionally implement Arbitrary for Naive{Date,Time,DateTime}
I'm not sure if you guys are interested in taking a change like this. If you are, I'd be happy to fill in more impls.
It seems like arbitrary is intended for use by fuzzers, are there examples of its use elsewhere? I don't have a lot of context from this PR.
@quodlibetor I'd love to use it. It's not only for crazy fuzzers but also for something what is rather a property based testing. E.g. particulary in my case: I have number of relative big domain models, which then transformed into DB records. I have also transformer functions that works in the opposite direction. Currently if I want to unit test it, the amount of tests I have to write is proportional to the complexity of the structures I have. I could use Arbitrary it would be just a couple lines of code:
- Generate a random domain model
- Transform it to DB records
- Transform DB records back
- Compare the original model with that one we got
This test would be much more smaller and, what is also important, not biased (unlike me, a developer).
If someone is willing to rebase or resubmit it, I would certainly consider it worthwhile.
@djc Hi! The PR was rebased (unfortunately I also missed that). Would you consider merging the PR or is there something else is required to get it merged?
@asayers @djc @conradludgate
I am very interested in this support of Arbitrary. Since @asayers apparently has no time to address the code review, I've done it on my own and opened a new PR: https://github.com/chronotope/chrono/pull/848 (which is alternative to this one)
@djc This one can be closed, since https://github.com/chronotope/chrono/pull/849 was merged.