aboutsummaryrefslogtreecommitdiff
path: root/src/zip/tests.rs
diff options
context:
space:
mode:
authorIgor Tolmachev <me@igorek.dev>2024-07-20 16:52:39 +0900
committerIgor Tolmachev <me@igorek.dev>2024-07-20 16:52:39 +0900
commit7bcdc3b4ca460aec2b98fb2dca6165788c562b05 (patch)
tree63f9616fc1b7f9ca6e414a4d32910720e155690c /src/zip/tests.rs
parent5f4ceda88c7299deb317f8d22a99ab2521c5a380 (diff)
downloadarchivator-7bcdc3b4ca460aec2b98fb2dca6165788c562b05.tar.gz
archivator-7bcdc3b4ca460aec2b98fb2dca6165788c562b05.zip
Partial aes implementation and others improvements
Diffstat (limited to 'src/zip/tests.rs')
-rw-r--r--src/zip/tests.rs19
1 files changed, 19 insertions, 0 deletions
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 @@
1use crate::zip::cp437::{from_char, is_cp437, to_char, FromCp437}; 1use crate::zip::cp437::{from_char, is_cp437, to_char, FromCp437};
2use crate::zip::datetime::DosDateTime;
2use crate::zip::{bit::DeflateMode, BitFlag}; 3use crate::zip::{bit::DeflateMode, BitFlag};
4use chrono::{DateTime, Local, TimeZone};
3 5
4#[test] 6#[test]
5fn test_bit_flag() { 7fn test_bit_flag() {
@@ -74,3 +76,20 @@ fn test_cp437() {
74 "abcdefghijklmnopqrstuvwxyz" 76 "abcdefghijklmnopqrstuvwxyz"
75 ); 77 );
76} 78}
79
80#[test]
81fn test_dos_datetime() {
82 let datetime = Local.with_ymd_and_hms(2001, 2, 3, 4, 5, 6).unwrap();
83 assert_eq!(
84 DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local)
85 .unwrap(),
86 datetime
87 );
88
89 let datetime = Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 9).unwrap();
90 assert_eq!(
91 DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local)
92 .unwrap(),
93 Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 8).unwrap()
94 ); // Dos format stores seconds with an accuracy of 2s
95}