diff options
author | danibw <[email protected]> | 2022-02-10 16:50:12 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:12 +0300 |
commit | 4b28e15652a7672062edb6804bc985eedc333257 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/logger/rotating_file_ut.cpp | |
parent | e8fdd1e6c0645bf1702aaf85cc7460dbd09977cb (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/logger/rotating_file_ut.cpp')
-rw-r--r-- | library/cpp/logger/rotating_file_ut.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/logger/rotating_file_ut.cpp b/library/cpp/logger/rotating_file_ut.cpp index 6cfa41da803..84966933d96 100644 --- a/library/cpp/logger/rotating_file_ut.cpp +++ b/library/cpp/logger/rotating_file_ut.cpp @@ -8,38 +8,38 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/testing/unittest/tests_data.h> -Y_UNIT_TEST_SUITE(NewRotatingFileSuite) { - const TString PATH = GetWorkPath() + "/my.log"; - - Y_UNIT_TEST(TestFileWrite) { - TRotatingFileLogBackend log(PATH, 4000, 2); - TString data = "my data"; - log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); - UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); - } - - Y_UNIT_TEST(TestFileRotate) { - const ui64 maxSize = 40; - TRotatingFileLogBackend log(PATH, maxSize, 2); - TStringBuilder data; - for (size_t i = 0; i < 10; ++i) - data << "data\n"; - log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); - UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); - data.clear(); - data << "more data"; - log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); - UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); - UNIT_ASSERT_C(TFileStat(TStringBuilder{} << PATH << ".1").Size > 0, "file " << PATH << ".1 has zero size"); - UNIT_ASSERT_C(TFileStat(PATH).Size < maxSize, "size of file " << PATH << " is greater than the size limit of " << maxSize << " bytes"); - } - - Y_UNIT_TEST(TestDoubleFileRotate) { - const ui64 maxSize = 40; - TRotatingFileLogBackend log(PATH, maxSize, 2); - TStringBuilder data; - for (size_t i = 0; i < 10; ++i) - data << "data\n"; +Y_UNIT_TEST_SUITE(NewRotatingFileSuite) { + const TString PATH = GetWorkPath() + "/my.log"; + + Y_UNIT_TEST(TestFileWrite) { + TRotatingFileLogBackend log(PATH, 4000, 2); + TString data = "my data"; + log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); + UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); + } + + Y_UNIT_TEST(TestFileRotate) { + const ui64 maxSize = 40; + TRotatingFileLogBackend log(PATH, maxSize, 2); + TStringBuilder data; + for (size_t i = 0; i < 10; ++i) + data << "data\n"; + log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); + UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); + data.clear(); + data << "more data"; + log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); + UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); + UNIT_ASSERT_C(TFileStat(TStringBuilder{} << PATH << ".1").Size > 0, "file " << PATH << ".1 has zero size"); + UNIT_ASSERT_C(TFileStat(PATH).Size < maxSize, "size of file " << PATH << " is greater than the size limit of " << maxSize << " bytes"); + } + + Y_UNIT_TEST(TestDoubleFileRotate) { + const ui64 maxSize = 40; + TRotatingFileLogBackend log(PATH, maxSize, 2); + TStringBuilder data; + for (size_t i = 0; i < 10; ++i) + data << "data\n"; log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); UNIT_ASSERT_C(TFileStat(PATH).Size > 0, "file " << PATH << " has zero size"); log.WriteData(TLogRecord(ELogPriority::TLOG_INFO, data.data(), data.size())); @@ -53,5 +53,5 @@ Y_UNIT_TEST_SUITE(NewRotatingFileSuite) { UNIT_ASSERT_C(TFileStat(TStringBuilder{} << PATH << ".1").Size > 0, "file " << PATH << ".1 has zero size"); UNIT_ASSERT_C(TFileStat(TStringBuilder{} << PATH << ".2").Size > 0, "file " << PATH << ".2 has zero size"); UNIT_ASSERT_C(TFileStat(PATH).Size < maxSize, "size of file " << PATH << " is greater than the size limit of " << maxSize << " bytes"); - } -} + } +} |