MCPcopy Create free account
hub / github.com/apache/brpc / TEST_F

Function TEST_F

test/file_util_unittest.cc:275–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273#endif
274
275TEST_F(FileUtilTest, FileAndDirectorySize) {
276 // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize
277 // should return 53 bytes.
278 FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt"));
279 CreateTextFile(file_01, L"12345678901234567890");
280 int64_t size_f1 = 0;
281 ASSERT_TRUE(GetFileSize(file_01, &size_f1));
282 EXPECT_EQ(20ll, size_f1);
283
284 FilePath subdir_path = temp_dir_.path().Append(FPL("Level2"));
285 CreateDirectory(subdir_path);
286
287 FilePath file_02 = subdir_path.Append(FPL("The file 02.txt"));
288 CreateTextFile(file_02, L"123456789012345678901234567890");
289 int64_t size_f2 = 0;
290 ASSERT_TRUE(GetFileSize(file_02, &size_f2));
291 EXPECT_EQ(30ll, size_f2);
292
293 FilePath subsubdir_path = subdir_path.Append(FPL("Level3"));
294 CreateDirectory(subsubdir_path);
295
296 FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt"));
297 CreateTextFile(file_03, L"123");
298
299 int64_t computed_size = ComputeDirectorySize(temp_dir_.path());
300 EXPECT_EQ(size_f1 + size_f2 + 3, computed_size);
301}
302
303TEST_F(FileUtilTest, NormalizeFilePathBasic) {
304 // Create a directory under the test dir. Because we create it,

Callers

nothing calls this directly

Calls 15

CreateTextFileFunction · 0.85
GetFileSizeFunction · 0.85
CreateDirectoryFunction · 0.85
ComputeDirectorySizeFunction · 0.85
PathExistsFunction · 0.85
NormalizeFilePathFunction · 0.85
CreateTemporaryFileInDirFunction · 0.85
CreateSymbolicLinkFunction · 0.85
ReadTextFileFunction · 0.85
ReadSymbolicLinkFunction · 0.85
DeleteFileFunction · 0.85
IsLinkFunction · 0.85

Tested by

no test coverage detected