added one more test
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2023-01-15 20:26:26 +01:00
parent 73dbc80cad
commit b2def8cd36
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -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() {