MCPcopy Create free account
hub / github.com/catboost/catboost / TestSimple

Method TestSimple

util/folder/fts_ut.cpp:56–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56void TFtsTest::TestSimple() {
57 const char* dotPath[2] = {"." LOCSLASH_S, nullptr};
58 TFileTree currentDirTree((char* const*)dotPath, 0, FtsCmp);
59 UNIT_ASSERT(currentDirTree());
60 TTempDir tempDir = MakeTempName(yfts_read(currentDirTree())->fts_path);
61 MakeDirIfNotExist(tempDir().data());
62 MakeDirIfNotExist((tempDir() + LOCSLASH_S "dir1").data());
63 MakeFile((tempDir() + LOCSLASH_S "dir1" LOCSLASH_S "file1").data());
64 MakeFile((tempDir() + LOCSLASH_S "dir1" LOCSLASH_S "file2").data());
65 MakeDirIfNotExist((tempDir() + LOCSLASH_S "dir2").data());
66 MakeFile((tempDir() + LOCSLASH_S "dir2" LOCSLASH_S "file3").data());
67 MakeFile((tempDir() + LOCSLASH_S "dir2" LOCSLASH_S "file4").data());
68
69 const char* path[2] = {tempDir().data(), nullptr};
70 TFileTree fileTree((char* const*)path, 0, FtsCmp);
71 UNIT_ASSERT(fileTree());
72 CheckEnt(yfts_read(fileTree()), tempDir().data(), FTS_D);
73 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir1").data(), FTS_D);
74 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir1" LOCSLASH_S "file1").data(), FTS_F);
75 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir1" LOCSLASH_S "file2").data(), FTS_F);
76 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir1").data(), FTS_DP);
77 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir2").data(), FTS_D);
78 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir2" LOCSLASH_S "file3").data(), FTS_F);
79 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir2" LOCSLASH_S "file4").data(), FTS_F);
80 CheckEnt(yfts_read(fileTree()), (tempDir() + LOCSLASH_S "dir2").data(), FTS_DP);
81 CheckEnt(yfts_read(fileTree()), (tempDir()).data(), FTS_DP);
82 UNIT_ASSERT_EQUAL(yfts_read(fileTree()), nullptr);
83}
84
85class TTempDirWithLostAccess: public TTempDir {
86public:

Callers

nothing calls this directly

Calls 6

MakeTempNameFunction · 0.85
yfts_readFunction · 0.85
MakeFileFunction · 0.85
CheckEntFunction · 0.85
MakeDirIfNotExistFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected