From 76043178d339982068f7699a90f8f95303a88958 Mon Sep 17 00:00:00 2001 From: Chris de Claverie Date: Mon, 3 Jan 2022 13:41:00 +0100 Subject: [PATCH] fix print test --- src/duration.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/duration.rs b/src/duration.rs index 698f4300..dc8f4638 100644 --- a/src/duration.rs +++ b/src/duration.rs @@ -955,10 +955,10 @@ fn duration_print() { ); // Check that we support nanoseconds pas GPS time - let now = TimeUnit::Nanosecond * 1286495254000000123_u128; + let now = TimeUnit::Nanosecond * 1286495254000000203_u128; assert_eq!( format!("{}", now).trim(), - "14889 days 23 h 47 min 34 s 0 ms 203 ns" + "40 years 289 days 23 h 47 min 34 s 0 ms 0 us 203 ns" ); let arbitrary = 14889.days() @@ -969,7 +969,7 @@ fn duration_print() { + 123.nanoseconds(); assert_eq!( format!("{}", arbitrary).trim(), - "14889 days 23 h 47 min 34 s 0 ms 123 ns" + "40 years 289 days 23 h 47 min 34 s 0 ms 0 us 123 ns" ); // Test fractional @@ -981,7 +981,7 @@ fn duration_print() { sum.in_unit_f64(TimeUnit::Minute), (1.0 / 4.0 + 1.0 / 3.0) * 60.0 ); - assert_eq!(format!("{}", sum).trim(), "35 min 0 s"); // Note the automatic unit selection + assert_eq!(format!("{}", sum).trim(), "35 min"); // Note the automatic unit selection let quarter_hour = -0.25 * TimeUnit::Hour; let third_hour: Duration = -1 * TimeUnit::Hour / 3; @@ -989,7 +989,7 @@ fn duration_print() { let delta = sum.in_unit(TimeUnit::Millisecond).floor() - sum.in_unit(TimeUnit::Second).floor() * 1000.0; println!("{:?}", delta * -1.0 == 0.0); // This floating-point comparison looks wrong - assert_eq!(format!("{}", sum).trim(), "-35 min 0 s"); // Note the automatic unit selection + assert_eq!(format!("{}", sum).trim(), "-35 min"); // Note the automatic unit selection } #[test]