aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/dbg_output/ut
diff options
context:
space:
mode:
authorkartynnik <kartynnik@yandex-team.ru>2022-02-10 16:48:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:07 +0300
commitca2a705e6e39e85df30054d7e806e572de9cfe23 (patch)
treefb7cc52bc2579366b2796a24f91f6df7a223f9ab /library/cpp/dbg_output/ut
parente20e2b362f0232ed5a389db887e6e27e7763af18 (diff)
downloadydb-ca2a705e6e39e85df30054d7e806e572de9cfe23.tar.gz
Restoring authorship annotation for <kartynnik@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/dbg_output/ut')
-rw-r--r--library/cpp/dbg_output/ut/dbg_output_ut.cpp92
-rw-r--r--library/cpp/dbg_output/ut/ya.make14
2 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/dbg_output/ut/dbg_output_ut.cpp b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
index 7b285c84cb..7839504bce 100644
--- a/library/cpp/dbg_output/ut/dbg_output_ut.cpp
+++ b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
@@ -1,17 +1,17 @@
#include <library/cpp/dbg_output/dump.h>
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/str.h>
+
+#include <util/stream/str.h>
#include <util/string/builder.h>
-#include <util/string/escape.h>
+#include <util/string/escape.h>
#include <util/generic/map.h>
-
+
namespace {
struct TX {
inline TX() {
N = this;
}
-
+
TX* N;
};
}
@@ -24,22 +24,22 @@ struct TDumper<TX> {
}
};
-namespace TMyNS {
- struct TMyStruct {
- int A, B;
- };
-}
-DEFINE_DUMPER(TMyNS::TMyStruct, A, B)
-
+namespace TMyNS {
+ struct TMyStruct {
+ int A, B;
+ };
+}
+DEFINE_DUMPER(TMyNS::TMyStruct, A, B)
+
Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
Y_UNIT_TEST(TestVectorInt) {
- TStringStream out;
+ TStringStream out;
out << DbgDump(TVector<int>({1, 2, 3, 4, 5}));
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[1, 2, 3, 4, 5]");
- }
-
+ }
+
Y_UNIT_TEST(TestMapCharToCharArray) {
- TStringStream out;
+ TStringStream out;
TMap<char, const char*> m;
@@ -49,51 +49,51 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
out << DbgDump(m);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{'a' -> \"SMALL LETTER A\", 'b' -> (empty)}");
- }
-
+ }
+
Y_UNIT_TEST(TestVectorOfVectors) {
- TStringStream out;
+ TStringStream out;
TVector<TVector<wchar16>> vec(2);
- vec[0].push_back(0);
+ vec[0].push_back(0);
vec[1] = {wchar16('a')};
out << DbgDump(vec);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[[w'\\0'], [w'a']]");
- }
+ }
Y_UNIT_TEST(TestInfinite) {
UNIT_ASSERT(!!(TStringBuilder() << DbgDumpDeep(TX())));
}
-
+
Y_UNIT_TEST(TestLabeledDump) {
- TStringStream out;
- int a = 1, b = 2;
- out << LabeledDump(a, b, 1 + 2);
+ TStringStream out;
+ int a = 1, b = 2;
+ out << LabeledDump(a, b, 1 + 2);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{\"a\": 1, \"b\": 2, \"1 + 2\": 3}");
- }
-
+ }
+
Y_UNIT_TEST(TestStructDumper) {
- TStringStream out;
- out << DbgDump(TMyNS::TMyStruct{3, 4});
+ TStringStream out;
+ out << DbgDump(TMyNS::TMyStruct{3, 4});
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{\"A\": 3, \"B\": 4}");
- }
-
+ }
+
Y_UNIT_TEST(TestColors) {
using TComplex = TMap<TString, TMap<int, char>>;
- TComplex test;
- test["a"][1] = '7';
- test["b"][2] = '6';
- TStringStream out;
- out << DbgDump<TComplex, NDbgDump::NColorScheme::TEyebleed</* Enforce = */ true>>(test);
- UNIT_ASSERT_STRINGS_EQUAL(
- EscapeC(out.Str()),
- "\\x1B[1;32m{\\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m\\\"a\\\"\\x1B[22;39m\\x1B[22;39m"
- "\\x1B[49m\\x1B[1;32m -> \\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m1"
- "\\x1B[22;39m\\x1B[1;32m -> \\x1B[1;31m'7'\\x1B[22;39m\\x1B[1;32m}"
- "\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m, \\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m"
- "\\\"b\\\"\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m -> "
- "\\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m2\\x1B[22;39m\\x1B[1;32m -> "
+ TComplex test;
+ test["a"][1] = '7';
+ test["b"][2] = '6';
+ TStringStream out;
+ out << DbgDump<TComplex, NDbgDump::NColorScheme::TEyebleed</* Enforce = */ true>>(test);
+ UNIT_ASSERT_STRINGS_EQUAL(
+ EscapeC(out.Str()),
+ "\\x1B[1;32m{\\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m\\\"a\\\"\\x1B[22;39m\\x1B[22;39m"
+ "\\x1B[49m\\x1B[1;32m -> \\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m1"
+ "\\x1B[22;39m\\x1B[1;32m -> \\x1B[1;31m'7'\\x1B[22;39m\\x1B[1;32m}"
+ "\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m, \\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m"
+ "\\\"b\\\"\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m -> "
+ "\\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m2\\x1B[22;39m\\x1B[1;32m -> "
"\\x1B[1;31m'6'\\x1B[22;39m\\x1B[1;32m}\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m}\\x1B[22;39m");
- }
+ }
Y_UNIT_TEST(SmallIntOrChar) {
char c = 'e';
@@ -103,4 +103,4 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
UNIT_ASSERT_VALUES_EQUAL(TStringBuilder() << DbgDump(i), "-100");
UNIT_ASSERT_VALUES_EQUAL(TStringBuilder() << DbgDump(u), "10");
}
-}
+}
diff --git a/library/cpp/dbg_output/ut/ya.make b/library/cpp/dbg_output/ut/ya.make
index 201601295d..77a8f38976 100644
--- a/library/cpp/dbg_output/ut/ya.make
+++ b/library/cpp/dbg_output/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/dbg_output)
-
+
OWNER(pg)
-
-SRCS(
- dbg_output_ut.cpp
-)
-
-END()
+
+SRCS(
+ dbg_output_ut.cpp
+)
+
+END()