diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/string/escape_ut.cpp | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/escape_ut.cpp')
-rw-r--r-- | util/string/escape_ut.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/util/string/escape_ut.cpp b/util/string/escape_ut.cpp index b1bd7f2a94..cd38ecffd3 100644 --- a/util/string/escape_ut.cpp +++ b/util/string/escape_ut.cpp @@ -7,20 +7,20 @@ using namespace std::string_view_literals; -namespace { - struct TExample { +namespace { + struct TExample { TString Expected; TString Source; - - TExample(const TStringBuf expected, const TStringBuf source) - : Expected{expected} + + TExample(const TStringBuf expected, const TStringBuf source) + : Expected{expected} , Source{source} { - } - }; -} - -static const TExample CommonTestData[] = { + } + }; +} + +static const TExample CommonTestData[] = { // Should be valid UTF-8. {"http://ya.ru/", "http://ya.ru/"}, {"http://ya.ru/\\x17\\n", "http://ya.ru/\x17\n"}, @@ -46,16 +46,16 @@ static const TExample CommonTestData[] = { {"There are questions \\x3F?", "There are questions ??"}, }; -Y_UNIT_TEST_SUITE(TEscapeCTest) { - Y_UNIT_TEST(TestStrokaEscapeC) { - for (const auto& e : CommonTestData) { +Y_UNIT_TEST_SUITE(TEscapeCTest) { + Y_UNIT_TEST(TestStrokaEscapeC) { + for (const auto& e : CommonTestData) { TString expected(e.Expected); TString source(e.Source); TString actual(EscapeC(e.Source)); TString actual2(UnescapeC(e.Expected)); - UNIT_ASSERT_VALUES_EQUAL(e.Expected, actual); - UNIT_ASSERT_VALUES_EQUAL(e.Source, actual2); + UNIT_ASSERT_VALUES_EQUAL(e.Expected, actual); + UNIT_ASSERT_VALUES_EQUAL(e.Source, actual2); } UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\x17\\n\\xAB", EscapeC(TString("http://ya.ru/\x17\n\xab"))); @@ -79,8 +79,8 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) { UNIT_ASSERT_VALUES_EQUAL("Странный компроматтест", UnescapeC(TString("\\u0421\\u0442\\u0440\\u0430\\u043d\\u043d\\u044b\\u0439 \\u043a\\u043e\\u043c\\u043f\\u0440\\u043e\\u043c\\u0430\\u0442тест"))); } - Y_UNIT_TEST(TestWtrokaEscapeC) { - for (const auto& e : CommonTestData) { + Y_UNIT_TEST(TestWtrokaEscapeC) { + for (const auto& e : CommonTestData) { TUtf16String expected(UTF8ToWide(e.Expected)); TUtf16String source(UTF8ToWide(e.Source)); TUtf16String actual(EscapeC(source)); @@ -95,7 +95,7 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) { UNIT_ASSERT_VALUES_EQUAL(u"\\xFF", EscapeC(wchar16(255))); } - Y_UNIT_TEST(TestEscapeTrigraphs) { + Y_UNIT_TEST(TestEscapeTrigraphs) { UNIT_ASSERT_VALUES_EQUAL("?", EscapeC(TString("?"))); UNIT_ASSERT_VALUES_EQUAL("\\x3F?", EscapeC(TString("??"))); UNIT_ASSERT_VALUES_EQUAL("\\x3F\\x3F?", EscapeC(TString("???"))); @@ -104,7 +104,7 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) { UNIT_ASSERT_VALUES_EQUAL("\\x3F?x\\x3F\\x3F?z", EscapeC(TString("??x???z"))); } - Y_UNIT_TEST(TestUnescapeCCharLen) { + Y_UNIT_TEST(TestUnescapeCCharLen) { auto test = [](const char* str, size_t len) { UNIT_ASSERT_EQUAL(UnescapeCCharLen(str, str + strlen(str)), len); }; @@ -131,7 +131,7 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) { test("\\4xxx", 2); } - Y_UNIT_TEST(TestUnbounded) { + Y_UNIT_TEST(TestUnbounded) { char buf[100000]; for (const auto& x : CommonTestData) { |