diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/testing | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r-- | library/cpp/testing/benchmark/bench.cpp | 20 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/examples/main.cpp | 8 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 8 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.h | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 48 |
6 files changed, 44 insertions, 44 deletions
diff --git a/library/cpp/testing/benchmark/bench.cpp b/library/cpp/testing/benchmark/bench.cpp index 9c6e6ae96d..08d8708005 100644 --- a/library/cpp/testing/benchmark/bench.cpp +++ b/library/cpp/testing/benchmark/bench.cpp @@ -189,7 +189,7 @@ namespace { } inline TSamples RemoveOutliers(const TSamples& s, double fraction) { - if (s.size() < 20) { + if (s.size() < 20) { return s; } @@ -205,7 +205,7 @@ namespace { using TSampleWithError = std::pair<const TSample*, double>; TVector<TSampleWithError> v; - v.reserve(s.size()); + v.reserve(s.size()); for (const auto& p : s) { v.emplace_back(&p, errfunc(p)); @@ -223,9 +223,9 @@ namespace { TSamples ret; - ret.reserve(v.size()); + ret.reserve(v.size()); - for (const auto i : xrange<size_t>(0, fraction * v.size())) { + for (const auto i : xrange<size_t>(0, fraction * v.size())) { ret.push_back(*v[i].first); } @@ -246,7 +246,7 @@ namespace { func(1); while (start.Passed() < budget) { - if (start.Passed() < ((budget * samples.size()) / 2000000.0)) { + if (start.Passed() < ((budget * samples.size()) / 2000000.0)) { ThreadYield(); } else { const size_t n = sample.Next(); @@ -258,7 +258,7 @@ namespace { auto filtered = RemoveOutliers(samples, 0.9); - return {test.Name(), filtered.size(), iters, CalcModel(filtered).A, Nothing(), start.Passed(), test.SequentialId}; + return {test.Name(), filtered.size(), iters, CalcModel(filtered).A, Nothing(), start.Passed(), test.SequentialId}; } using TTests = TIntrusiveListWithAutoDelete<ITestRunner, TDestructor>; @@ -523,7 +523,7 @@ namespace { const TOptsParseResult parseResult{&opts, argc, argv}; for (const auto& regexp : parseResult.GetFreeArgs()) { - Filters.push_back(MakeHolder<RE2>(regexp.data(), RE2::Quiet)); + Filters.push_back(MakeHolder<RE2>(regexp.data(), RE2::Quiet)); Y_ENSURE(Filters.back()->ok(), "incorrect RE2 expression '" << regexp << "'"); } } @@ -534,7 +534,7 @@ namespace { } for (auto&& re : Filters) { - if (RE2::FullMatchN({name.data(), name.size()}, *re, nullptr, 0)) { + if (RE2::FullMatchN({name.data(), name.size()}, *re, nullptr, 0)) { return true; } } @@ -577,10 +577,10 @@ int NBench::Main(int argc, char** argv) { double timeBudget = opts.TimeBudget; if (timeBudget < 0) { - timeBudget = 5.0 * tests.size(); + timeBudget = 5.0 * tests.size(); } - const TOptions testOpts = {timeBudget / tests.size()}; + const TOptions testOpts = {timeBudget / tests.size()}; const auto reporter = MakeOrderedReporter(opts.OutFormat); std::function<void(ITestRunner**)> func = [&](ITestRunner** it) { diff --git a/library/cpp/testing/benchmark/examples/main.cpp b/library/cpp/testing/benchmark/examples/main.cpp index 50d0554289..ddd8b05ffc 100644 --- a/library/cpp/testing/benchmark/examples/main.cpp +++ b/library/cpp/testing/benchmark/examples/main.cpp @@ -100,19 +100,19 @@ Y_NO_INLINE int FFF(int x, int y) { } Y_NO_INLINE size_t FS1(TStringBuf x) { - return x.size(); + return x.size(); } Y_NO_INLINE size_t FS1_2(TStringBuf x, TStringBuf y) { - return x.size() + y.size(); + return x.size() + y.size(); } Y_NO_INLINE size_t FS2(const TStringBuf& x) { - return x.size(); + return x.size(); } Y_NO_INLINE size_t FS2_2(const TStringBuf& x, const TStringBuf& y) { - return x.size() + y.size(); + return x.size() + y.size(); } Y_CPU_BENCHMARK(FunctionCallCost_StringBufVal1, iface) { diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 7d40ff2c27..3679b768ed 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -35,7 +35,7 @@ currentTest; ::NUnitTest::TRaiseErrorHandler RaiseErrorHandler; void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, bool fatalFailure) { - Y_VERIFY(UnittestThread, "%s in non-unittest thread with message:\n%s", what, msg.data()); + Y_VERIFY(UnittestThread, "%s in non-unittest thread with message:\n%s", what, msg.data()); Y_VERIFY(GetCurrentTest()); if (RaiseErrorHandler) { @@ -46,7 +46,7 @@ void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, boo // Default handler TBackTrace bt; bt.Capture(); - GetCurrentTest()->AddError(msg.data(), bt.PrintToString()); + GetCurrentTest()->AddError(msg.data(), bt.PrintToString()); if (::NUnitTest::ContinueOnFail || !fatalFailure) { return; } @@ -414,7 +414,7 @@ NUnitTest::TTestBase::TCleanUp::~TCleanUp() { try { Base_->AfterTest(); } catch (...) { - Base_->AddError(CurrentExceptionMessage().data()); + Base_->AddError(CurrentExceptionMessage().data()); } ::NUnitTest::NPrivate::SetUnittestThread(false); ::NUnitTest::NPrivate::SetCurrentTest(nullptr); @@ -434,7 +434,7 @@ namespace { struct TCmp { template <class T> inline bool operator()(const T& l, const T& r) const noexcept { - return stricmp(Fix(l.Name().data()), Fix(r.Name().data())) < 0; + return stricmp(Fix(l.Name().data()), Fix(r.Name().data())) < 0; } static inline const char* Fix(const char* n) noexcept { diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 2774c8b4a9..44517a0092 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -454,7 +454,7 @@ public: \ const TString _a(A); \ const TString _b(B); \ if (_a != _b) { \ - UNIT_FAIL_IMPL("strings (" #A ") and (" #B ") are different", Sprintf("\n%s", ::NUnitTest::ColoredDiff(_a, _b, " \t\n.,:;'\"").data())); \ + UNIT_FAIL_IMPL("strings (" #A ") and (" #B ") are different", Sprintf("\n%s", ::NUnitTest::ColoredDiff(_a, _b, " \t\n.,:;'\"").data())); \ } \ } while (false) diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp index 35e71adf61..1f36d53abb 100644 --- a/library/cpp/testing/unittest/registar_ut.cpp +++ b/library/cpp/testing/unittest/registar_ut.cpp @@ -253,7 +253,7 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_TEST_FAILS(valuesUnequal(5, 5)); UNIT_ASSERT_TEST_FAILS(valuesUnequal(static_cast<char>(5), 5l)); TString test("test"); - UNIT_ASSERT_TEST_FAILS(valuesUnequal("test", test.data())); + UNIT_ASSERT_TEST_FAILS(valuesUnequal("test", test.data())); UNIT_ASSERT_VALUES_UNEQUAL("UNIT_ASSERT_VALUES_UNEQUAL", "UNIT_ASSERT_VALUES_EQUAL"); UNIT_ASSERT_VALUES_UNEQUAL(1.0, 1.1); diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index d7d73662af..305bc6b40f 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -41,7 +41,7 @@ #endif #ifdef WITH_VALGRIND -#define NOTE_IN_VALGRIND(test) VALGRIND_PRINTF("%s::%s", test->unit->name.data(), test->name) +#define NOTE_IN_VALGRIND(test) VALGRIND_PRINTF("%s::%s", test->unit->name.data(), test->name) #else #define NOTE_IN_VALGRIND(test) #endif @@ -87,7 +87,7 @@ private: event.InsertValue("class", className); event.InsertValue("subtest", subtestName); event.InsertValue("status", status); - event.InsertValue("comment", comment.data()); + event.InsertValue("comment", comment.data()); event.InsertValue("time", (now - PrevTime).SecondsFloat()); if (context) { for (const auto& metric : context->Metrics) { @@ -140,13 +140,13 @@ private: } void OnError(const TError* descr) override { - const TString comment = BuildComment(descr->msg, descr->BackTrace.data()); + const TString comment = BuildComment(descr->msg, descr->BackTrace.data()); ErrorMessages.push_back(comment); } void OnFinish(const TFinish* descr) override { if (descr->Success) { - TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "good", "", descr->Context); + TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "good", "", descr->Context); } else { TStringBuilder msgs; for (const TString& m : ErrorMessages) { @@ -158,7 +158,7 @@ private: if (msgs) { msgs << TStringBuf("\n"); } - TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "fail", msgs, descr->Context); + TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "fail", msgs, descr->Context); ErrorMessages.clear(); } } @@ -302,7 +302,7 @@ private: return; } if (PrintBeforeSuite_ || PrintBeforeTest_) { - fprintf(stderr, "%s<-----%s %s\n", LightBlueColor().data(), OldColor().data(), unit->name.data()); + fprintf(stderr, "%s<-----%s %s\n", LightBlueColor().data(), OldColor().data(), unit->name.data()); } } @@ -316,11 +316,11 @@ private: } fprintf(stderr, "%s----->%s %s -> ok: %s%u%s", - LightBlueColor().data(), OldColor().data(), unit->name.data(), - LightGreenColor().data(), GoodTestsInCurrentUnit(), OldColor().data()); + LightBlueColor().data(), OldColor().data(), unit->name.data(), + LightGreenColor().data(), GoodTestsInCurrentUnit(), OldColor().data()); if (FailTestsInCurrentUnit()) { fprintf(stderr, ", err: %s%u%s", - LightRedColor().data(), FailTestsInCurrentUnit(), OldColor().data()); + LightRedColor().data(), FailTestsInCurrentUnit(), OldColor().data()); } fprintf(stderr, "\n"); } @@ -331,7 +331,7 @@ private: return; } if (PrintBeforeTest_) { - fprintf(stderr, "[%sexec%s] %s::%s...\n", LightBlueColor().data(), OldColor().data(), test->unit->name.data(), test->name); + fprintf(stderr, "[%sexec%s] %s::%s...\n", LightBlueColor().data(), OldColor().data(), test->unit->name.data(), test->name); } } @@ -344,19 +344,19 @@ private: return; } - const TString err = Sprintf("[%sFAIL%s] %s::%s -> %s%s%s\n%s%s%s", LightRedColor().data(), OldColor().data(), - descr->test->unit->name.data(), + const TString err = Sprintf("[%sFAIL%s] %s::%s -> %s%s%s\n%s%s%s", LightRedColor().data(), OldColor().data(), + descr->test->unit->name.data(), descr->test->name, - LightRedColor().data(), descr->msg, OldColor().data(), LightCyanColor().data(), descr->BackTrace.data(), OldColor().data()); + LightRedColor().data(), descr->msg, OldColor().data(), LightCyanColor().data(), descr->BackTrace.data(), OldColor().data()); const TDuration test_duration = SaveTestDuration(); if (ShowFails) { if (PrintTimes_) { - Fails.push_back(Sprintf("%s %s", test_duration.ToString().data(), err.data())); + Fails.push_back(Sprintf("%s %s", test_duration.ToString().data(), err.data())); } else { Fails.push_back(err); } } - fprintf(stderr, "%s", err.data()); + fprintf(stderr, "%s", err.data()); NOTE_IN_VALGRIND(descr->test); PrintTimes(test_duration); if (IsForked) { @@ -374,8 +374,8 @@ private: } if (descr->Success) { - fprintf(stderr, "[%sgood%s] %s::%s\n", LightGreenColor().data(), OldColor().data(), - descr->test->unit->name.data(), + fprintf(stderr, "[%sgood%s] %s::%s\n", LightGreenColor().data(), OldColor().data(), + descr->test->unit->name.data(), descr->test->name); NOTE_IN_VALGRIND(descr->test); PrintTimes(SaveTestDuration()); @@ -411,16 +411,16 @@ private: } fprintf(stderr, "[%sDONE%s] ok: %s%u%s", - YellowColor().data(), OldColor().data(), - LightGreenColor().data(), GoodTests(), OldColor().data()); + YellowColor().data(), OldColor().data(), + LightGreenColor().data(), GoodTests(), OldColor().data()); if (FailTests()) fprintf(stderr, ", err: %s%u%s", - LightRedColor().data(), FailTests(), OldColor().data()); + LightRedColor().data(), FailTests(), OldColor().data()); fprintf(stderr, "\n"); if (ShowFails) { for (size_t i = 0; i < Fails.size(); ++i) { - printf("%s", Fails[i].data()); + printf("%s", Fails[i].data()); } } } @@ -434,7 +434,7 @@ private: return false; } - if (DisabledSuites_.find(name.data()) != DisabledSuites_.end()) { + if (DisabledSuites_.find(name.data()) != DisabledSuites_.end()) { return false; } @@ -442,7 +442,7 @@ private: return true; } - return EnabledSuites_.find(name.data()) != EnabledSuites_.end(); + return EnabledSuites_.find(name.data()) != EnabledSuites_.end(); } bool CheckAccessTest(TString suite, const char* test) override { @@ -468,7 +468,7 @@ private: } TList<TString> args(1, "--is-forked-internal"); - args.push_back(Sprintf("+%s::%s", suite.data(), name)); + args.push_back(Sprintf("+%s::%s", suite.data(), name)); // stdin is ignored - unittest should not need them... TShellCommand cmd(AppName, args, |