From 7bcdc3b4ca460aec2b98fb2dca6165788c562b05 Mon Sep 17 00:00:00 2001 From: Igor Tolmachev Date: Sat, 20 Jul 2024 16:52:39 +0900 Subject: Partial aes implementation and others improvements --- src/zip/tests.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/zip/tests.rs') diff --git a/src/zip/tests.rs b/src/zip/tests.rs index e24cdfe..a8ac634 100644 --- a/src/zip/tests.rs +++ b/src/zip/tests.rs @@ -1,5 +1,7 @@ use crate::zip::cp437::{from_char, is_cp437, to_char, FromCp437}; +use crate::zip::datetime::DosDateTime; use crate::zip::{bit::DeflateMode, BitFlag}; +use chrono::{DateTime, Local, TimeZone}; #[test] fn test_bit_flag() { @@ -74,3 +76,20 @@ fn test_cp437() { "abcdefghijklmnopqrstuvwxyz" ); } + +#[test] +fn test_dos_datetime() { + let datetime = Local.with_ymd_and_hms(2001, 2, 3, 4, 5, 6).unwrap(); + assert_eq!( + DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local) + .unwrap(), + datetime + ); + + let datetime = Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 9).unwrap(); + assert_eq!( + DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local) + .unwrap(), + Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 8).unwrap() + ); // Dos format stores seconds with an accuracy of 2s +} -- cgit v1.2.3