This commit is contained in:
Scott E. Graves 2024-09-26 16:16:02 -05:00
parent fd83c263e1
commit e81227e5f7

View File

@ -25,16 +25,13 @@
#include "utils/file.hpp"
namespace repertory {
#if defined(_WIN32)
TEST(utils, convert_api_date) {
#if defined(_WIN32)
auto file_time = utils::time::unix_time_to_filetime(
s3_provider::convert_api_date("2009-10-12T17:50:30.111Z"));
FILETIME file_time2{};
FileTimeToLocalFileTime(&file_time, &file_time2);
SYSTEMTIME st{};
FileTimeToSystemTime(&file_time2, &st);
FileTimeToSystemTime(&file_time, &st);
EXPECT_EQ(2009, st.wYear);
EXPECT_EQ(10, st.wMonth);
@ -44,8 +41,14 @@ TEST(utils, convert_api_date) {
EXPECT_EQ(50, st.wMinute);
EXPECT_EQ(30, st.wSecond);
EXPECT_EQ(111, st.wMilliseconds);
}
#else // !defined(_WIN32)
auto unix_time = s3_provider::convert_api_date("2009-10-12T17:50:30.111Z");
auto *tm_data = gmtime(&unix_time);
EXPECT_TRUE(tm_data != nullptr);
if (tm_data != nullptr) {
}
#endif // defined(_WIN32)
}
TEST(utils, generate_sha256) {
auto res = utils::file::file{__FILE__}.sha256();