Skip to content

Commit

Permalink
tests: improve qzss coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume W. Bres <[email protected]>
  • Loading branch information
gwbres committed May 21, 2023
1 parent 26ba849 commit 15b3849
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/asn1der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<'a> Decode<'a> for Unit {
// Testing the encoding and decoding of an Epoch inherently also tests the encoding and decoding of a Duration
#[test]
fn test_encdec() {
for ts_u8 in 0..=7 {
for ts_u8 in 0..=8 {
let ts: TimeScale = ts_u8.into();

let epoch = if ts == TimeScale::UTC {
Expand Down
7 changes: 7 additions & 0 deletions tests/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,13 @@ fn test_time_of_week() {
epoch_utc
);

// GPST and QZSST share the same properties at all times
let epoch_qzsst = epoch.in_time_scale(TimeScale::QZSST);
assert_eq!(epoch.to_gregorian_utc(), epoch_qzsst.to_gregorian_utc());

let gps_qzss_offset = TimeScale::GPST.ref_epoch() - TimeScale::QZSST.ref_epoch();
assert_eq!(gps_qzss_offset.total_nanoseconds(), 0); // no offset

// 06/01/1980 01:00:00 = 1H into GPST <=> (0, 3_618_000_000_000)
let epoch = Epoch::from_time_of_week(0, 3_618_000_000_000, TimeScale::GPST);
assert_eq!(epoch.to_gregorian_utc(), (1980, 01, 06, 01, 00, 0 + 18, 00));
Expand Down

0 comments on commit 15b3849

Please sign in to comment.