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

Function Y_UNIT_TEST

util/system/fstat_ut.cpp:12–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11Y_UNIT_TEST_SUITE(TestFileStat) {
12 Y_UNIT_TEST(FileTest) {
13 TString fileName = "f1.txt";
14 TFileStat oFs;
15 {
16 TFile file(fileName.data(), OpenAlways | WrOnly);
17 file.Write("1234567", 7);
18
19 {
20 TFileStat fs(file);
21 UNIT_ASSERT(fs.IsFile());
22 UNIT_ASSERT(!fs.IsDir());
23 UNIT_ASSERT(!fs.IsSymlink());
24 UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), (i64)fs.Size);
25 UNIT_ASSERT(fs.MTime >= fs.CTime);
26 UNIT_ASSERT(fs.NLinks == 1);
27 oFs = fs;
28 }
29
30 UNIT_ASSERT(file.IsOpen());
31 UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7);
32 file.Close();
33 }
34 TFileStat cFs(fileName);
35 UNIT_ASSERT(cFs.IsFile());
36 UNIT_ASSERT(!cFs.IsDir());
37 UNIT_ASSERT(!cFs.IsSymlink());
38 UNIT_ASSERT_VALUES_EQUAL(cFs.Size, oFs.Size);
39 UNIT_ASSERT(cFs.MTime >= oFs.MTime);
40 UNIT_ASSERT_VALUES_EQUAL(cFs.CTime, oFs.CTime);
41 UNIT_ASSERT_VALUES_EQUAL(cFs.NLinks, oFs.NLinks);
42 UNIT_ASSERT_VALUES_EQUAL(cFs.Mode, oFs.Mode);
43 UNIT_ASSERT_VALUES_EQUAL(cFs.Uid, oFs.Uid);
44 UNIT_ASSERT_VALUES_EQUAL(cFs.Gid, oFs.Gid);
45 UNIT_ASSERT_VALUES_EQUAL(cFs.INode, oFs.INode);
46 UNIT_ASSERT(unlink(fileName.data()) == 0);
47 }
48
49 Y_UNIT_TEST(DirTest) {
50 Mkdir("tmpd", MODE0777);

Callers

nothing calls this directly

Calls 15

TFileStatClass · 0.85
GetOutputPathFunction · 0.85
IsDirMethod · 0.80
MkDirsMethod · 0.80
MkdirFunction · 0.70
TFileClass · 0.70
TFsPathClass · 0.70
ChmodFunction · 0.70
ToStringFunction · 0.50
dataMethod · 0.45
WriteMethod · 0.45
IsFileMethod · 0.45

Tested by

no test coverage detected