| 14 | namespace mdf::test { |
| 15 | |
| 16 | TEST(CryptoUtil, CreateMd5FileChecksum) // NOLINT |
| 17 | { |
| 18 | bool skip_test; |
| 19 | try { |
| 20 | skip_test = !std::filesystem::exists(kTestFile); |
| 21 | } catch (const std::exception&) { |
| 22 | skip_test = true; |
| 23 | } |
| 24 | if (skip_test) { |
| 25 | GTEST_SKIP(); |
| 26 | } |
| 27 | |
| 28 | // Test that it runs normally |
| 29 | const auto md5_normal = CreateMd5FileString(kTestFile.data()); |
| 30 | EXPECT_TRUE(!md5_normal.empty()); |
| 31 | EXPECT_EQ(md5_normal.size(), 32U) << md5_normal; |
| 32 | std::cout << "MD5: " << md5_normal << std::endl; |
| 33 | |
| 34 | // Check that it handles files missing |
| 35 | const auto md5_abnormal = CreateMd5FileString("testXXX.exe"); |
| 36 | EXPECT_TRUE(md5_abnormal.empty()); |
| 37 | } |
| 38 | |
| 39 | } // namespace mdf::test |
nothing calls this directly
no test coverage detected