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

Prevent spurious overflow in check_duration_roundtrip test #804

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion prost-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,10 @@ mod tests {

#[test]
fn check_duration_roundtrip(
std_duration in time::Duration::arbitrary(),
seconds in u64::arbitrary(),
nanos in 0u32..1_000_000_000u32,
) {
let std_duration = time::Duration::new(seconds, nanos);
let prost_duration = match Duration::try_from(std_duration) {
Ok(duration) => duration,
Err(_) => return Err(TestCaseError::reject("duration out of range")),
Expand Down