Skip to content

Commit

Permalink
FMT
Browse files Browse the repository at this point in the history
  • Loading branch information
LevBeta committed Mar 3, 2024
1 parent 86eb768 commit 6eb00b3
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions prost-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,17 +919,35 @@ mod tests {

#[test]
fn check_timestamp_ord() {
let earlier_timestamp = Timestamp { seconds: 10, nanos: 500 };
let later_timestamp = Timestamp { seconds: 10, nanos: 700 };
let equal_timestamp = Timestamp { seconds: 10, nanos: 500 };
let earlier_timestamp = Timestamp {
seconds: 10,
nanos: 500,
};
let later_timestamp = Timestamp {
seconds: 10,
nanos: 700,
};
let equal_timestamp = Timestamp {
seconds: 10,
nanos: 500,
};

assert!(earlier_timestamp < later_timestamp);
assert!(earlier_timestamp <= later_timestamp);
assert!(later_timestamp > earlier_timestamp);
assert!(later_timestamp >= earlier_timestamp);

assert_eq!(earlier_timestamp.cmp(&later_timestamp), std::cmp::Ordering::Less);
assert_eq!(later_timestamp.cmp(&earlier_timestamp), std::cmp::Ordering::Greater);
assert_eq!(equal_timestamp.cmp(&earlier_timestamp), std::cmp::Ordering::Equal);
assert_eq!(
earlier_timestamp.cmp(&later_timestamp),
std::cmp::Ordering::Less
);
assert_eq!(
later_timestamp.cmp(&earlier_timestamp),
std::cmp::Ordering::Greater
);
assert_eq!(
equal_timestamp.cmp(&earlier_timestamp),
std::cmp::Ordering::Equal
);
}
}

0 comments on commit 6eb00b3

Please sign in to comment.