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

Function Y_UNIT_TEST

library/cpp/logger/reopen_ut.cpp:37–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36Y_UNIT_TEST_SUITE(ReopenLogSuite) {
37 Y_UNIT_TEST(TestSimple) {
38 constexpr ui64 limit = 5;
39 const auto testData = {"test", "dshkafhuadshfiasuh", "log", "data"};
40 constexpr ui64 expectedReopens = 2; // considering the limit, the first reopen after the second string and one more at the end
41
42 auto mockHolder = MakeHolder<TMockLogBackend>();
43 auto& mock = *mockHolder;
44 TReopenLogBackend log(std::move(mockHolder), limit);
45
46 ui64 expectedWritten = 0;
47 for (const TString str : testData) {
48 WriteData(log, str);
49 expectedWritten += str.size();
50 }
51
52 UNIT_ASSERT(mock.BytesWritten.load() == expectedWritten);
53 UNIT_ASSERT(mock.NumReopens.load() == expectedReopens);
54 }
55
56 Y_UNIT_TEST(TestSingleThreaded) {
57 constexpr ui64 limit = 1_KB;

Callers

nothing calls this directly

Calls 7

TReopenLogBackendClass · 0.85
WriteDataFunction · 0.70
moveFunction · 0.50
sizeMethod · 0.45
loadMethod · 0.45
emplace_backMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected