aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/fstat_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/system/fstat_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/fstat_ut.cpp')
-rw-r--r--util/system/fstat_ut.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp
index 160ecd936e..15fcf06859 100644
--- a/util/system/fstat_ut.cpp
+++ b/util/system/fstat_ut.cpp
@@ -11,55 +11,55 @@
Y_UNIT_TEST_SUITE(TestFileStat) {
Y_UNIT_TEST(FileTest) {
TString fileName = "f1.txt";
- TFileStat oFs;
- {
+ TFileStat oFs;
+ {
TFile file(fileName.data(), OpenAlways | WrOnly);
- file.Write("1234567", 7);
-
- {
- TFileStat fs(file);
- UNIT_ASSERT(fs.IsFile());
- UNIT_ASSERT(!fs.IsDir());
- UNIT_ASSERT(!fs.IsSymlink());
- UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), (i64)fs.Size);
- UNIT_ASSERT(fs.MTime >= fs.CTime);
- UNIT_ASSERT(fs.NLinks == 1);
- oFs = fs;
- }
-
- UNIT_ASSERT(file.IsOpen());
- UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7);
- file.Close();
+ file.Write("1234567", 7);
+
+ {
+ TFileStat fs(file);
+ UNIT_ASSERT(fs.IsFile());
+ UNIT_ASSERT(!fs.IsDir());
+ UNIT_ASSERT(!fs.IsSymlink());
+ UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), (i64)fs.Size);
+ UNIT_ASSERT(fs.MTime >= fs.CTime);
+ UNIT_ASSERT(fs.NLinks == 1);
+ oFs = fs;
+ }
+
+ UNIT_ASSERT(file.IsOpen());
+ UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7);
+ file.Close();
}
- TFileStat cFs(fileName);
- UNIT_ASSERT(cFs.IsFile());
- UNIT_ASSERT(!cFs.IsDir());
- UNIT_ASSERT(!cFs.IsSymlink());
- UNIT_ASSERT_VALUES_EQUAL(cFs.Size, oFs.Size);
- UNIT_ASSERT(cFs.MTime >= oFs.MTime);
- UNIT_ASSERT_VALUES_EQUAL(cFs.CTime, oFs.CTime);
- UNIT_ASSERT_VALUES_EQUAL(cFs.NLinks, oFs.NLinks);
- UNIT_ASSERT_VALUES_EQUAL(cFs.Mode, oFs.Mode);
- UNIT_ASSERT_VALUES_EQUAL(cFs.Uid, oFs.Uid);
- UNIT_ASSERT_VALUES_EQUAL(cFs.Gid, oFs.Gid);
+ TFileStat cFs(fileName);
+ UNIT_ASSERT(cFs.IsFile());
+ UNIT_ASSERT(!cFs.IsDir());
+ UNIT_ASSERT(!cFs.IsSymlink());
+ UNIT_ASSERT_VALUES_EQUAL(cFs.Size, oFs.Size);
+ UNIT_ASSERT(cFs.MTime >= oFs.MTime);
+ UNIT_ASSERT_VALUES_EQUAL(cFs.CTime, oFs.CTime);
+ UNIT_ASSERT_VALUES_EQUAL(cFs.NLinks, oFs.NLinks);
+ UNIT_ASSERT_VALUES_EQUAL(cFs.Mode, oFs.Mode);
+ UNIT_ASSERT_VALUES_EQUAL(cFs.Uid, oFs.Uid);
+ UNIT_ASSERT_VALUES_EQUAL(cFs.Gid, oFs.Gid);
UNIT_ASSERT_VALUES_EQUAL(cFs.INode, oFs.INode);
UNIT_ASSERT(unlink(fileName.data()) == 0);
- }
+ }
Y_UNIT_TEST(DirTest) {
- Mkdir("tmpd", MODE0777);
- TFileStat fs("tmpd");
- UNIT_ASSERT(!fs.IsFile());
- UNIT_ASSERT(fs.IsDir());
- UNIT_ASSERT(!fs.IsSymlink());
- //UNIT_ASSERT(fs.Size == 0); // it fails under unix
+ Mkdir("tmpd", MODE0777);
+ TFileStat fs("tmpd");
+ UNIT_ASSERT(!fs.IsFile());
+ UNIT_ASSERT(fs.IsDir());
+ UNIT_ASSERT(!fs.IsSymlink());
+ //UNIT_ASSERT(fs.Size == 0); // it fails under unix
UNIT_ASSERT(NFs::Remove("tmpd"));
- fs = TFileStat("tmpd");
- UNIT_ASSERT(!fs.IsFile());
- UNIT_ASSERT(!fs.IsDir());
- UNIT_ASSERT(!fs.IsSymlink());
- UNIT_ASSERT(fs.Size == 0);
- UNIT_ASSERT(fs.CTime == 0);
+ fs = TFileStat("tmpd");
+ UNIT_ASSERT(!fs.IsFile());
+ UNIT_ASSERT(!fs.IsDir());
+ UNIT_ASSERT(!fs.IsSymlink());
+ UNIT_ASSERT(fs.Size == 0);
+ UNIT_ASSERT(fs.CTime == 0);
}
Y_UNIT_TEST(SymlinkToExistingFileTest) {
@@ -154,4 +154,4 @@ Y_UNIT_TEST_SUITE(TestFileStat) {
UNIT_ASSERT(unlink(fileName.c_str()) == 0);
}
-}
+}