@@ -118,3 +118,60 @@ impl TryFrom<Zoned> for Time {
118118 Self :: new ( params) . map_err ( |e| ConversionError ( ConversionErrorInner :: InvalidUefiTime ( e) ) )
119119 }
120120}
121+
122+ #[ cfg( test) ]
123+ mod tests {
124+ use super :: super :: integration_common:: test_helpers;
125+ use super :: * ;
126+
127+ #[ test]
128+ fn primitive_roundtrip_basic ( ) {
129+ test_helpers:: primitive_roundtrip :: < DateTime > ( ) ;
130+ }
131+
132+ #[ test]
133+ fn zoned_roundtrip_positive_offset ( ) {
134+ test_helpers:: zoned_roundtrip :: < Zoned > ( ) ;
135+ }
136+
137+ #[ test]
138+ fn zoned_roundtrip_negative_offset ( ) {
139+ test_helpers:: negative_offset_roundtrip :: < Zoned > ( ) ;
140+ }
141+
142+ #[ test]
143+ fn nanoseconds_preserved ( ) {
144+ test_helpers:: preserves_nanoseconds :: < Zoned > ( ) ;
145+ }
146+
147+ #[ test]
148+ fn unspecified_timezone_is_rejected ( ) {
149+ test_helpers:: unspecified_timezone_fails :: < Zoned > ( ) ;
150+ }
151+
152+ #[ test]
153+ fn invalid_date_is_rejected ( ) {
154+ test_helpers:: invalid_calendar_date_fails :: < DateTime > ( ) ;
155+ }
156+
157+ // jiff-specific edge case: offset minute precision
158+ #[ test]
159+ fn half_hour_timezone_roundtrip ( ) {
160+ let t = test_helpers:: sample_time ( 90 ) ; // +01:30
161+
162+ let z: Zoned = t. try_into ( ) . unwrap ( ) ;
163+ let back: Time = z. try_into ( ) . unwrap ( ) ;
164+
165+ assert_eq ! ( back. 0 . time_zone, 90 ) ;
166+ }
167+
168+ #[ test]
169+ fn negative_half_hour_timezone_roundtrip ( ) {
170+ let t = test_helpers:: sample_time ( -330 ) ; // -05:30
171+
172+ let z: Zoned = t. try_into ( ) . unwrap ( ) ;
173+ let back: Time = z. try_into ( ) . unwrap ( ) ;
174+
175+ assert_eq ! ( back. 0 . time_zone, -330 ) ;
176+ }
177+ }
0 commit comments