diff options
author | antonovvk <antonovvk@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
commit | 37de222addabbef336dcaaea5f7c7645a629fc6d (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/testing | |
parent | 37a63debdc21e372d99e1808cdd31aecf75018c3 (diff) | |
download | ydb-37de222addabbef336dcaaea5f7c7645a629fc6d.tar.gz |
Restoring authorship annotation for <antonovvk@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 36 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.h | 6 |
2 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 8dbcb8ab95..3679b768ed 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -2,7 +2,7 @@ #include <library/cpp/diff/diff.h> #include <library/cpp/colorizer/colors.h> - + #include <util/generic/bt_exception.h> #include <util/random/fast.h> #include <util/string/printf.h> @@ -62,7 +62,7 @@ void ::NUnitTest::NPrivate::SetUnittestThread(bool unittestThread) { Y_VERIFY(UnittestThread != unittestThread, "state check"); UnittestThread = unittestThread; } - + void ::NUnitTest::NPrivate::SetCurrentTest(TTestBase* test) { Y_VERIFY(!test || !currentTest, "state check"); currentTest = test; @@ -72,10 +72,10 @@ NUnitTest::TTestBase* ::NUnitTest::NPrivate::GetCurrentTest() { return currentTest; } -struct TDiffColorizer { - NColorizer::TColors Colors; +struct TDiffColorizer { + NColorizer::TColors Colors; bool Reverse = false; - + explicit TDiffColorizer(bool reverse = false) : Reverse(reverse) { @@ -83,19 +83,19 @@ struct TDiffColorizer { TString Special(TStringBuf str) const { return ToString(Colors.YellowColor()) + str; - } - + } + TString Common(TArrayRef<const char> str) const { return ToString(Colors.OldColor()) + TString(str.begin(), str.end()); - } - + } + TString Left(TArrayRef<const char> str) const { return ToString(GetLeftColor()) + TString(str.begin(), str.end()); - } - + } + TString Right(TArrayRef<const char> str) const { return ToString(GetRightColor()) + TString(str.begin(), str.end()); - } + } TStringBuf GetLeftColor() const { return Reverse ? Colors.RedColor() : Colors.GreenColor(); @@ -104,8 +104,8 @@ struct TDiffColorizer { TStringBuf GetRightColor() const { return Reverse ? Colors.GreenColor() : Colors.RedColor(); } -}; - +}; + struct TTraceDiffFormatter { bool Reverse = false; @@ -144,17 +144,17 @@ TString NUnitTest::GetResetTag() { } TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { - TStringStream res; + TStringStream res; TVector<NDiff::TChunk<char>> chunks; - NDiff::InlineDiff(chunks, s1, s2, delims); + NDiff::InlineDiff(chunks, s1, s2, delims); if (NUnitTest::ShouldColorizeDiff) { NDiff::PrintChunks(res, TDiffColorizer(reverse), chunks); } else { res << NUnitTest::GetResetTag(); NDiff::PrintChunks(res, TTraceDiffFormatter(reverse), chunks); } - return res.Str(); -} + return res.Str(); +} static TString MakeTestName(const NUnitTest::ITestSuiteProcessor::TTest& test) { return TStringBuilder() << test.unit->name << "::" << test.name; diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 22c0eaafa4..44517a0092 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -44,7 +44,7 @@ namespace NUnitTest { 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 // and unittest helpers. @@ -456,8 +456,8 @@ public: \ if (_a != _b) { \ UNIT_FAIL_IMPL("strings (" #A ") and (" #B ") are different", Sprintf("\n%s", ::NUnitTest::ColoredDiff(_a, _b, " \t\n.,:;'\"").data())); \ } \ - } while (false) - + } while (false) + //strings #define UNIT_ASSERT_STRINGS_UNEQUAL_C(A, B, C) \ do { \ |