MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / TEST

Function TEST

lib/mdflib/mdflib_test/src/testcrypto.cpp:16–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace mdf::test {
15
16TEST(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

Callers

nothing calls this directly

Calls 4

CreateMd5FileStringFunction · 0.85
emptyMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected