diff options
author | kartynnik <kartynnik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
commit | df6128370874866447314ec18d8e67fc7bde40b4 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/dbg_output/ut | |
parent | ca2a705e6e39e85df30054d7e806e572de9cfe23 (diff) | |
download | ydb-df6128370874866447314ec18d8e67fc7bde40b4.tar.gz |
Restoring authorship annotation for <kartynnik@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/dbg_output/ut')
-rw-r--r-- | library/cpp/dbg_output/ut/dbg_output_ut.cpp | 92 | ||||
-rw-r--r-- | library/cpp/dbg_output/ut/ya.make | 14 |
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 7839504bce..7b285c84cb 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 77a8f38976..201601295d 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() |