added one more test
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
This commit is contained in:
parent
73dbc80cad
commit
b2def8cd36
@ -1967,6 +1967,21 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_dt_invalid_time() {
|
||||
// Date before CCSDS epoch
|
||||
let naivedatetime_utc = NaiveDate::from_ymd_opt(1957, 12, 31)
|
||||
.unwrap()
|
||||
.and_hms_milli_opt(23, 59, 59, 999)
|
||||
.unwrap();
|
||||
let datetime_utc = DateTime::<Utc>::from_utc(naivedatetime_utc, Utc);
|
||||
let time_provider = TimeProvider::from_dt_with_u24_days(&datetime_utc);
|
||||
assert!(time_provider.is_err());
|
||||
if let TimestampError::DateBeforeCcsdsEpoch(dt) = time_provider.unwrap_err() {
|
||||
assert_eq!(dt, datetime_utc);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "serde")]
|
||||
fn test_serialization() {
|
||||
|
Loading…
Reference in New Issue
Block a user