MCPcopy Create free account
hub / github.com/apache/arrow / TestGetFileInfoVector

Method TestGetFileInfoVector

cpp/src/arrow/filesystem/test_util.cc:717–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717void GenericFileSystemTest::TestGetFileInfoVector(FileSystem* fs) {
718 ASSERT_OK(fs->CreateDir("AB/CD"));
719 CreateFile(fs, "AB/CD/ghi", "some data");
720
721 std::vector<FileInfo> infos;
722 TimePoint dir_time, file_time;
723 ASSERT_OK_AND_ASSIGN(
724 infos, fs->GetFileInfo({"AB", "AB/CD", "AB/zz", "zz", "XX/zz", "AB/CD/ghi"}));
725 ASSERT_EQ(infos.size(), 6);
726 AssertFileInfo(infos[0], "AB", FileType::Directory);
727 dir_time = infos[0].mtime();
728 if (have_directory_mtimes()) {
729 ValidateTimePoint(dir_time);
730 }
731 AssertFileInfo(infos[1], "AB/CD", FileType::Directory);
732 AssertFileInfo(infos[2], "AB/zz", FileType::NotFound);
733 AssertFileInfo(infos[3], "zz", FileType::NotFound);
734 AssertFileInfo(infos[4], "XX/zz", FileType::NotFound);
735 ASSERT_EQ(infos[4].size(), kNoSize);
736 ASSERT_EQ(infos[4].mtime(), kNoTime);
737 AssertFileInfo(infos[5], "AB/CD/ghi", FileType::File, 9);
738 file_time = infos[5].mtime();
739 if (have_directory_mtimes()) {
740 AssertDurationBetween(file_time - dir_time, 0.0, kTimeSlack);
741 } else {
742 ValidateTimePoint(file_time);
743 }
744
745 // Check the mtime is the same from one call to the other
746 FileInfo info;
747 if (have_directory_mtimes()) {
748 ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB"));
749 AssertFileInfo(info, "AB", FileType::Directory);
750 ASSERT_EQ(info.mtime(), dir_time);
751 }
752 ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/ghi"));
753 AssertFileInfo(info, "AB/CD/ghi", FileType::File, 9);
754 ASSERT_EQ(info.mtime(), file_time);
755}
756
757void GenericFileSystemTest::TestGetFileInfoSelector(FileSystem* fs) {
758 ASSERT_OK(fs->CreateDir("AB/CD"));

Callers

nothing calls this directly

Calls 9

CreateFileFunction · 0.85
AssertFileInfoFunction · 0.85
have_directory_mtimesFunction · 0.85
ValidateTimePointFunction · 0.85
AssertDurationBetweenFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
CreateDirMethod · 0.45
GetFileInfoMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected