-
Notifications
You must be signed in to change notification settings - Fork 9
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
ISO 8601 parsing/formatting for RelativeDuration #14
Conversation
@olliemath I think this is good to go. A couple of notes though:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. Aside from some minor comments, the main issue is how to handle nanoseconds, which I really think we should
Thanks so much for this. For 1, yes this currently requires suppressing the warning, however I'm planning to remove support for the deprecated chrono types and functions in 0.3 (can't do this in a minor release). For 2, property based testing is nice in small amounts, and I'm not adverse to adding another dev dependency. Apart from checking that the parse and format functions don't throw weird errors with arbitrary inputs, we would ideally have a test along the lines of: assert_eq!(d, RelativeDuration::from_iso_8601(d.to_iso_8601())) That's the easy direction because equality between RelativeDurations is stable under transformations like assert_eq!(s, RelativeDuration::from_iso_8601(s).to_iso_8601()) because this will only hold for strings in "reduced" form, so you need a smart generation strategy to generate examples in this form. |
Would it be possible to add some benchmarks for cargo bench (see the benches directory for an example). This way we can work on optimisations in the future. |
Thanks for the thorough review! I added property tests and benchmarks as requested. |
Thanks for adding the tests and benchmarks - this looks good - will merge and prepare for the 0.2.7 release. I plan make one small tweak to rename of the functions from |
Resolves #13