diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/testing | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r-- | library/cpp/testing/benchmark/bench.cpp | 18 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/examples/main.cpp | 4 | ||||
-rw-r--r-- | library/cpp/testing/common/env.cpp | 6 | ||||
-rw-r--r-- | library/cpp/testing/common/env.h | 2 | ||||
-rw-r--r-- | library/cpp/testing/gmock_in_unittest/events.cpp | 6 | ||||
-rw-r--r-- | library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp | 8 | ||||
-rw-r--r-- | library/cpp/testing/unittest/checks.cpp | 4 | ||||
-rw-r--r-- | library/cpp/testing/unittest/gtest.cpp | 14 | ||||
-rw-r--r-- | library/cpp/testing/unittest/gtest.h | 4 | ||||
-rw-r--r-- | library/cpp/testing/unittest/plugin.cpp | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 22 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.h | 36 | ||||
-rw-r--r-- | library/cpp/testing/unittest/tests_data.h | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 76 |
14 files changed, 102 insertions, 102 deletions
diff --git a/library/cpp/testing/benchmark/bench.cpp b/library/cpp/testing/benchmark/bench.cpp index 08d8708005..70b9bcaf36 100644 --- a/library/cpp/testing/benchmark/bench.cpp +++ b/library/cpp/testing/benchmark/bench.cpp @@ -100,7 +100,7 @@ namespace { } struct THiPerfTimer: public THPTimer { - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { return DoFmtTime(t); } }; @@ -110,7 +110,7 @@ namespace { return (TInstant::Now() - N).MicroSeconds() / 1000000.0; } - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { return DoFmtTime(t); } @@ -122,12 +122,12 @@ namespace { return GetCycleCount() - N; } - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { if (t < 0.5) { t = 0.0; } - TString hr; + TString hr; if (t > 10 * 1000) { hr = " (" + ToString(HumanReadableSize(t, ESizeFormat::SF_QUANTITY)) + ")"; } @@ -162,7 +162,7 @@ namespace { }; using TSample = std::pair<size_t, double>; - using TSamples = TVector<TSample>; + using TSamples = TVector<TSample>; struct TLinFunc { double A; @@ -203,7 +203,7 @@ namespace { }; using TSampleWithError = std::pair<const TSample*, double>; - TVector<TSampleWithError> v; + TVector<TSampleWithError> v; v.reserve(s.size()); @@ -384,7 +384,7 @@ namespace { private: TAdaptiveLock ResultsLock_; - TVector<TResult> Results_; + TVector<TResult> Results_; }; class TOrderedReporter: public IReporter { @@ -544,7 +544,7 @@ namespace { bool ListTests = false; double TimeBudget = -1.0; - TVector<THolder<RE2>> Filters; + TVector<THolder<RE2>> Filters; size_t Threads = 0; EOutFormat OutFormat; }; @@ -553,7 +553,7 @@ namespace { int NBench::Main(int argc, char** argv) { const TProgOpts opts(argc, argv); - TVector<ITestRunner*> tests; + TVector<ITestRunner*> tests; for (auto&& it : Tests()) { if (opts.MatchFilters(it.Name())) { diff --git a/library/cpp/testing/benchmark/examples/main.cpp b/library/cpp/testing/benchmark/examples/main.cpp index ddd8b05ffc..16c467894f 100644 --- a/library/cpp/testing/benchmark/examples/main.cpp +++ b/library/cpp/testing/benchmark/examples/main.cpp @@ -7,7 +7,7 @@ #include <util/generic/bt_exception.h> Y_CPU_BENCHMARK(F, iface) { - TVector<size_t> x; + TVector<size_t> x; x.reserve(iface.Iterations()); @@ -23,7 +23,7 @@ Y_CPU_BENCHMARK(EmptyF, iface) { Y_CPU_BENCHMARK(AlmostEmptyF, iface) { (void)iface; - TVector<size_t> x; + TVector<size_t> x; x.resize(1); } diff --git a/library/cpp/testing/common/env.cpp b/library/cpp/testing/common/env.cpp index fa3a47fe16..edd9ab4e88 100644 --- a/library/cpp/testing/common/env.cpp +++ b/library/cpp/testing/common/env.cpp @@ -40,7 +40,7 @@ TString BinaryPath(TStringBuf path) { return (TFsPath(BuildRoot()) / path).Fix(); } -TString GetArcadiaTestsData() { +TString GetArcadiaTestsData() { TString atdRoot = NPrivate::GetTestEnv().ArcadiaTestsDataDir; if (atdRoot) { return atdRoot; @@ -49,7 +49,7 @@ TString GetArcadiaTestsData() { TString path = NPrivate::GetCwd(); const char pathsep = GetDirectorySeparator(); while (!path.empty()) { - TString dataDir = path + "/arcadia_tests_data"; + TString dataDir = path + "/arcadia_tests_data"; if (IsDir(dataDir)) { return dataDir; } @@ -64,7 +64,7 @@ TString GetArcadiaTestsData() { return {}; } -TString GetWorkPath() { +TString GetWorkPath() { TString workPath = NPrivate::GetTestEnv().WorkPath; if (workPath) { return workPath; diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed..f2878c2d26 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -3,7 +3,7 @@ #include <unordered_map> #include <util/folder/path.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/system/src_location.h> diff --git a/library/cpp/testing/gmock_in_unittest/events.cpp b/library/cpp/testing/gmock_in_unittest/events.cpp index dbd65b727d..9169cc3abb 100644 --- a/library/cpp/testing/gmock_in_unittest/events.cpp +++ b/library/cpp/testing/gmock_in_unittest/events.cpp @@ -3,13 +3,13 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/builder.h> void TGMockTestEventListener::OnTestPartResult(const testing::TestPartResult& result) { if (result.failed()) { - const TString message = result.message(); - const TString summary = result.summary(); + const TString message = result.message(); + const TString summary = result.summary(); TStringBuilder msg; if (result.file_name()) msg << result.file_name() << TStringBuf(":"); diff --git a/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp b/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp index 97f19050e4..7174802c9f 100644 --- a/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp +++ b/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> // Set this variable to true if you want to see failures ///////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ public: virtual void Func1() = 0; - virtual int Func2(const TString&) const = 0; + virtual int Func2(const TString&) const = 0; }; class TTestMock: public ITestIface { @@ -50,11 +50,11 @@ Y_UNIT_TEST_SUITE(TExampleGMockTest) { Y_UNIT_TEST(TReturnValuesTest) { TTestMock mock; - EXPECT_CALL(mock, Func2(TString("1"))) + EXPECT_CALL(mock, Func2(TString("1"))) .WillOnce(Return(1)) .WillRepeatedly(Return(42)); - EXPECT_CALL(mock, Func2(TString("hello"))) + EXPECT_CALL(mock, Func2(TString("hello"))) .WillOnce(Return(-1)); UNIT_ASSERT_VALUES_EQUAL(mock.Func2("hello"), -1); diff --git a/library/cpp/testing/unittest/checks.cpp b/library/cpp/testing/unittest/checks.cpp index c5712ae9d2..0f4b3dae9d 100644 --- a/library/cpp/testing/unittest/checks.cpp +++ b/library/cpp/testing/unittest/checks.cpp @@ -1,7 +1,7 @@ #include <util/generic/string.h> #include <util/string/type.h> -bool CheckExceptionMessage(const char* msg, TString& err) { +bool CheckExceptionMessage(const char* msg, TString& err) { static const char* badMsg[] = { // Операция успешно завершена [cp1251] "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0", @@ -22,7 +22,7 @@ bool CheckExceptionMessage(const char* msg, TString& err) { for (auto& i : badMsg) { if (strstr(msg, i) != nullptr) { - err = "Invalid error message: " + TString(msg); + err = "Invalid error message: " + TString(msg); return false; } } diff --git a/library/cpp/testing/unittest/gtest.cpp b/library/cpp/testing/unittest/gtest.cpp index ebad1ea4d6..6aded3e085 100644 --- a/library/cpp/testing/unittest/gtest.cpp +++ b/library/cpp/testing/unittest/gtest.cpp @@ -8,7 +8,7 @@ using namespace NUnitTest; using namespace NUnitTest::NPrivate; -IGTestFactory::~IGTestFactory() { +IGTestFactory::~IGTestFactory() { } namespace { @@ -18,12 +18,12 @@ namespace { { } - TString TypeId() const override { + TString TypeId() const override { return TypeName(*this) + "-" + MyName; } - TString Name() const noexcept override { - return TString(MyName); + TString Name() const noexcept override { + return TString(MyName); } const TStringBuf MyName; @@ -35,10 +35,10 @@ namespace { { } - ~TGTestFactory() override { + ~TGTestFactory() override { } - TString Name() const noexcept override { + TString Name() const noexcept override { return Test.Name(); } @@ -55,7 +55,7 @@ namespace { } IGTestFactory* NUnitTest::NPrivate::ByName(const char* name) { - static TMap<TStringBuf, TAutoPtr<TGTestFactory>> tests; + static TMap<TStringBuf, TAutoPtr<TGTestFactory>> tests; auto& ret = tests[name]; diff --git a/library/cpp/testing/unittest/gtest.h b/library/cpp/testing/unittest/gtest.h index b6768b1bf0..15e71cc495 100644 --- a/library/cpp/testing/unittest/gtest.h +++ b/library/cpp/testing/unittest/gtest.h @@ -13,7 +13,7 @@ namespace NUnitTest { namespace NPrivate { struct IGTestFactory: public ITestBaseFactory { - ~IGTestFactory() override; + ~IGTestFactory() override; virtual void AddTest(const char* name, void (*body)(TTestContext&), bool forceFork) = 0; }; @@ -30,7 +30,7 @@ namespace NTesting { virtual void TearDown() { } - inline TTest* _This() noexcept { + inline TTest* _This() noexcept { return this; } }; diff --git a/library/cpp/testing/unittest/plugin.cpp b/library/cpp/testing/unittest/plugin.cpp index 543112f7ac..194de77254 100644 --- a/library/cpp/testing/unittest/plugin.cpp +++ b/library/cpp/testing/unittest/plugin.cpp @@ -30,7 +30,7 @@ namespace NUnitTest { } private: - TVector<TSimpleSharedPtr<IPlugin>> Plugins; + TVector<TSimpleSharedPtr<IPlugin>> Plugins; }; } // anonymous namespace diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed..9b75850e97 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -15,9 +15,9 @@ bool NUnitTest::ShouldColorizeDiff = true; bool NUnitTest::ContinueOnFail = false; -TString NUnitTest::RandomString(size_t len, ui32 seed) { +TString NUnitTest::RandomString(size_t len, ui32 seed) { TReallyFastRng32 rand(seed); - TString ret; + TString ret; ret.reserve(len); @@ -34,7 +34,7 @@ Y_POD_STATIC_THREAD(NUnitTest::TTestBase*) currentTest; ::NUnitTest::TRaiseErrorHandler RaiseErrorHandler; -void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, bool fatalFailure) { +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(GetCurrentTest()); @@ -119,7 +119,7 @@ struct TTraceDiffFormatter { } TString Common(TArrayRef<const char> str) const { - return TString(str.begin(), str.end()); + return TString(str.begin(), str.end()); } TString Left(TArrayRef<const char> str) const { @@ -135,17 +135,17 @@ struct TTraceDiffFormatter { } }; -TString NUnitTest::GetFormatTag(const char* name) { +TString NUnitTest::GetFormatTag(const char* name) { return Sprintf("[[%s]]", name); } -TString NUnitTest::GetResetTag() { - return TString("[[rst]]"); +TString NUnitTest::GetResetTag() { + return TString("[[rst]]"); } -TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { +TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { TStringStream res; - TVector<NDiff::TChunk<char>> chunks; + TVector<NDiff::TChunk<char>> chunks; NDiff::InlineDiff(chunks, s1, s2, delims); if (NUnitTest::ShouldColorizeDiff) { NDiff::PrintChunks(res, TDiffColorizer(reverse), chunks); @@ -160,7 +160,7 @@ static TString MakeTestName(const NUnitTest::ITestSuiteProcessor::TTest& test) { return TStringBuilder() << test.unit->name << "::" << test.name; } -static size_t CountTests(const TMap<TString, size_t>& testErrors, bool succeeded) { +static size_t CountTests(const TMap<TString, size_t>& testErrors, bool succeeded) { size_t cnt = 0; for (const auto& t : testErrors) { if (succeeded && t.second == 0) { @@ -465,7 +465,7 @@ unsigned NUnitTest::TTestFactory::Execute() { Items_.QuickSort(TCmp()); Processor_->Start(); - TSet<TString> types; + TSet<TString> types; size_t cnt = 0; for (TIntrusiveList<ITestBaseFactory>::TIterator factory = Items_.Begin(); factory != Items_.End(); ++factory) { diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..a02b5ffe90 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -27,13 +27,13 @@ #include <cstdio> #include <functional> -extern bool CheckExceptionMessage(const char*, TString&); +extern bool CheckExceptionMessage(const char*, TString&); namespace NUnitTest { class TTestBase; namespace NPrivate { - void RaiseError(const char* what, const TString& msg, bool fatalFailure); + void RaiseError(const char* what, const TString& msg, bool fatalFailure); void SetUnittestThread(bool); void SetCurrentTest(TTestBase*); TTestBase* GetCurrentTest(); @@ -41,9 +41,9 @@ namespace NUnitTest { extern bool ShouldColorizeDiff; extern bool ContinueOnFail; - TString ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims = TString(), bool reverse = false); - TString GetFormatTag(const char* name); - TString GetResetTag(); + TString ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims = TString(), bool reverse = false); + TString GetFormatTag(const char* name); + TString GetResetTag(); // Raise error handler // Used for testing library/cpp/testing/unittest macroses @@ -73,7 +73,7 @@ namespace NUnitTest { { } - using TMetrics = THashMap<TString, double>; + using TMetrics = THashMap<TString, double>; TMetrics Metrics; ITestSuiteProcessor* Processor; @@ -82,7 +82,7 @@ namespace NUnitTest { class ITestSuiteProcessor { public: struct TUnit { - const TString name; + const TString name; }; struct TTest { @@ -93,7 +93,7 @@ namespace NUnitTest { struct TError { const TTest* test; const char* msg; - TString BackTrace; + TString BackTrace; TTestContext* Context; }; @@ -163,8 +163,8 @@ namespace NUnitTest { void AddTestFinish(const TTest& test); private: - TMap<TString, size_t> TestErrors_; - TMap<TString, size_t> CurTestErrors_; + TMap<TString, size_t> TestErrors_; + TMap<TString, size_t> CurTestErrors_; }; class TTestBase; @@ -177,7 +177,7 @@ namespace NUnitTest { virtual ~ITestBaseFactory(); // name of test suite - virtual TString Name() const noexcept = 0; + virtual TString Name() const noexcept = 0; virtual TTestBase* ConstructTest() = 0; private: @@ -195,7 +195,7 @@ namespace NUnitTest { virtual TString TypeId() const; - virtual TString Name() const noexcept = 0; + virtual TString Name() const noexcept = 0; virtual void Execute() = 0; virtual void SetUp(); @@ -431,7 +431,7 @@ public: \ const TString _b(B); \ if (_a != _b) { \ auto&& failMsg = Sprintf("%s != %s %s", ToString(_a).data(), ToString(_b).data(), (::TStringBuilder() << C).data()); \ - UNIT_FAIL_IMPL("strings equal assertion failed", failMsg); \ + UNIT_FAIL_IMPL("strings equal assertion failed", failMsg); \ } \ } while (false) @@ -686,7 +686,7 @@ public: \ // helper method to avoid double evaluation of A and B expressions in UNIT_ASSERT_VALUES_EQUAL_C template <typename T, typename U> - static inline bool CompareAndMakeStrings(const T& a, const U& b, TString& as, TString& asInd, TString& bs, TString& bsInd, bool& usePlainDiff, bool want) { + static inline bool CompareAndMakeStrings(const T& a, const U& b, TString& as, TString& asInd, TString& bs, TString& bsInd, bool& usePlainDiff, bool want) { const bool have = CompareEqual(a, b); usePlainDiff = std::is_integral<T>::value && std::is_integral<U>::value; @@ -714,10 +714,10 @@ public: \ if (!::NUnitTest::NPrivate::CompareAndMakeStrings(A, B, _as, _asInd, _bs, _bsInd, _usePlainDiff, EQflag)) { \ auto&& failMsg = Sprintf("(%s %s %s) failed: (%s %s %s) %s", #A, EQstr, #B, _as.data(), NEQstr, _bs.data(), (::TStringBuilder() << C).data()); \ if (EQflag && !_usePlainDiff) { \ - failMsg += ", with diff:\n"; \ - failMsg += ::NUnitTest::ColoredDiff(_asInd, _bsInd); \ + failMsg += ", with diff:\n"; \ + failMsg += ::NUnitTest::ColoredDiff(_asInd, _bsInd); \ } \ - UNIT_FAIL_IMPL("assertion failed", failMsg); \ + UNIT_FAIL_IMPL("assertion failed", failMsg); \ } \ } while (false) @@ -1024,7 +1024,7 @@ public: \ #define Y_UNIT_TEST_FRIEND(N, T) \ friend NTestSuite##N::TTestCase##T \ - TString RandomString(size_t len, ui32 seed = 0); + TString RandomString(size_t len, ui32 seed = 0); } using ::NUnitTest::TTestBase; diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6536bc1ae6..14ea88eb7c 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -4,7 +4,7 @@ #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/network/sock.h> class TInet6StreamSocket; diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..b2e9d67690 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -14,7 +14,7 @@ #include <util/generic/hash.h> #include <util/generic/hash_set.h> #include <util/generic/scope.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/network/init.h> @@ -58,16 +58,16 @@ public: inline TTraceWriterProcessor(const char* traceFilePath, EOpenMode mode) : PrevTime(TInstant::Now()) { - TraceFile = new TUnbufferedFileOutput(TFile(traceFilePath, mode | WrOnly | Seq)); + TraceFile = new TUnbufferedFileOutput(TFile(traceFilePath, mode | WrOnly | Seq)); } private: - TAutoPtr<TUnbufferedFileOutput> TraceFile; - TString TraceFilePath; + TAutoPtr<TUnbufferedFileOutput> TraceFile; + TString TraceFilePath; TInstant PrevTime; - TVector<TString> ErrorMessages; + TVector<TString> ErrorMessages; - inline void Trace(const TString eventName, const NJson::TJsonValue eventValue) { + inline void Trace(const TString eventName, const NJson::TJsonValue eventValue) { NJsonWriter::TBuf json(NJsonWriter::HEM_UNSAFE); json.BeginObject(); @@ -81,7 +81,7 @@ private: *TraceFile << "\n"; } - inline void TraceSubtestFinished(const char* className, const char* subtestName, const char* status, const TString comment, const TTestContext* context) { + inline void TraceSubtestFinished(const char* className, const char* subtestName, const char* status, const TString comment, const TTestContext* context) { const TInstant now = TInstant::Now(); NJson::TJsonValue event; event.InsertValue("class", className); @@ -97,7 +97,7 @@ private: Trace("subtest-finished", event); PrevTime = now; - TString marker = Join("", "\n###subtest-finished:", className, "::", subtestName, "\n"); + TString marker = Join("", "\n###subtest-finished:", className, "::", subtestName, "\n"); Cout << marker; Cout.Flush(); Cerr << comment; @@ -105,7 +105,7 @@ private: Cerr.Flush(); } - virtual TString BuildComment(const char* message, const char* backTrace) { + virtual TString BuildComment(const char* message, const char* backTrace) { return NUnitTest::GetFormatTag("bad") + TString(message).substr(0, MAX_COMMENT_MESSAGE_LENGTH) + NUnitTest::GetResetTag() + @@ -120,7 +120,7 @@ private: event.InsertValue("class", test->unit->name); event.InsertValue("subtest", test->name); Trace("subtest-started", event); - TString marker = Join("", "\n###subtest-started:", test->unit->name, "::", test->name, "\n"); + TString marker = Join("", "\n###subtest-started:", test->unit->name, "::", test->name, "\n"); Cout << marker; Cout.Flush(); Cerr << marker; @@ -149,7 +149,7 @@ private: TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "good", "", descr->Context); } else { TStringBuilder msgs; - for (const TString& m : ErrorMessages) { + for (const TString& m : ErrorMessages) { if (msgs) { msgs << TStringBuf("\n"); } @@ -166,7 +166,7 @@ private: class TColoredProcessor: public ITestSuiteProcessor, public NColorizer::TColors { public: - inline TColoredProcessor(const TString& appName) + inline TColoredProcessor(const TString& appName) : PrintBeforeSuite_(true) , PrintBeforeTest_(true) , PrintAfterTest_(true) @@ -186,30 +186,30 @@ public: { } - ~TColoredProcessor() override { + ~TColoredProcessor() override { } inline void Disable(const char* name) { - size_t colon = TString(name).find("::"); - if (colon == TString::npos) { + size_t colon = TString(name).find("::"); + if (colon == TString::npos) { DisabledSuites_.insert(name); } else { - TString suite = TString(name).substr(0, colon); + TString suite = TString(name).substr(0, colon); DisabledTests_.insert(name); } } inline void Enable(const char* name) { - size_t colon = TString(name).rfind("::"); - if (colon == TString::npos) { + size_t colon = TString(name).rfind("::"); + if (colon == TString::npos) { EnabledSuites_.insert(name); - EnabledTests_.insert(TString() + name + "::*"); + EnabledTests_.insert(TString() + name + "::*"); } else { - TString suite = TString(name).substr(0, colon); + TString suite = TString(name).substr(0, colon); EnabledSuites_.insert(suite); EnabledSuites_.insert(name); EnabledTests_.insert(name); - EnabledTests_.insert(TString() + name + "::*"); + EnabledTests_.insert(TString() + name + "::*"); } } @@ -425,7 +425,7 @@ private: } } - bool CheckAccess(TString name, size_t num) override { + bool CheckAccess(TString name, size_t num) override { if (num < Start) { return false; } @@ -445,8 +445,8 @@ private: return EnabledSuites_.find(name.data()) != EnabledSuites_.end(); } - bool CheckAccessTest(TString suite, const char* test) override { - TString name = suite + "::" + test; + bool CheckAccessTest(TString suite, const char* test) override { + TString name = suite + "::" + test; if (DisabledTests_.find(name) != DisabledTests_.end()) { return false; } @@ -455,7 +455,7 @@ private: return true; } - if (EnabledTests_.find(TString() + suite + "::*") != EnabledTests_.end()) { + if (EnabledTests_.find(TString() + suite + "::*") != EnabledTests_.end()) { return true; } @@ -467,7 +467,7 @@ private: return f(); } - TList<TString> args(1, "--is-forked-internal"); + TList<TString> args(1, "--is-forked-internal"); args.push_back(Sprintf("+%s::%s", suite.data(), name)); // stdin is ignored - unittest should not need them... @@ -475,12 +475,12 @@ private: TShellCommandOptions().SetUseShell(false).SetCloseAllFdsOnExec(true).SetAsync(false).SetLatency(1)); cmd.Run(); - const TString& err = cmd.GetError(); + const TString& err = cmd.GetError(); const size_t msgIndex = err.find(ForkCorrectExitMsg); // everything is printed by parent process except test's result output ("good" or "fail") // which is printed by child. If there was no output - parent process prints default message. - ForkExitedCorrectly = msgIndex != TString::npos; + ForkExitedCorrectly = msgIndex != TString::npos; // TODO: stderr output is always printed after stdout Cout.Write(cmd.GetOutput()); @@ -517,16 +517,16 @@ private: bool PrintAfterSuite_; bool PrintTimes_; bool PrintSummary_; - THashSet<TString> DisabledSuites_; - THashSet<TString> EnabledSuites_; - THashSet<TString> DisabledTests_; - THashSet<TString> EnabledTests_; + THashSet<TString> DisabledSuites_; + THashSet<TString> EnabledSuites_; + THashSet<TString> DisabledTests_; + THashSet<TString> EnabledTests_; TInstant PrevTime_; bool ShowFails; - TVector<TString> Fails; + TVector<TString> Fails; size_t Start; size_t End; - TString AppName; + TString AppName; bool ForkTests; bool IsForked; bool Loop; @@ -545,10 +545,10 @@ public: { } - ~TEnumeratingProcessor() override { + ~TEnumeratingProcessor() override { } - bool CheckAccess(TString name, size_t /*num*/) override { + bool CheckAccess(TString name, size_t /*num*/) override { if (Verbose_) { return true; } else { @@ -557,7 +557,7 @@ public: } } - bool CheckAccessTest(TString suite, const char* name) override { + bool CheckAccessTest(TString suite, const char* name) override { Stream_ << suite << "::" << name << "\n"; return false; } @@ -732,7 +732,7 @@ int NUnitTest::RunMain(int argc, char** argv) { TString param(argv[i]); size_t assign = param.find('='); Singleton<::NPrivate::TTestEnv>()->AddTestParam(param.substr(0, assign), param.substr(assign + 1)); - } else if (TString(name).StartsWith("--")) { + } else if (TString(name).StartsWith("--")) { return DoUsage(argv[0]), 1; } else if (*name == '-') { processor.Disable(name + 1); |