aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/strip_ut.cpp
diff options
context:
space:
mode:
authormvel <mvel@yandex-team.ru>2022-02-10 16:45:41 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:41 +0300
commitbd30392c4cc92487950adc375c07adf52da1d592 (patch)
treee8d1a3f19b7fc890bcef6e4cc5de41f1d88c9ac3 /util/string/strip_ut.cpp
parent5d50718e66d9c037dc587a0211110b7d25a66185 (diff)
downloadydb-bd30392c4cc92487950adc375c07adf52da1d592.tar.gz
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/strip_ut.cpp')
-rw-r--r--util/string/strip_ut.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index d1029d1498..0a6b8e362f 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -6,25 +6,25 @@
Y_UNIT_TEST_SUITE(TStripStringTest) {
Y_UNIT_TEST(TestStrip) {
- struct TTest {
+ struct TTest {
const char* Str;
const char* StripLeftRes;
const char* StripRightRes;
const char* StripRes;
- };
- static const TTest tests[] = {
- {" 012 ", "012 ", " 012", "012"},
- {" 012", "012", " 012", "012"},
- {"012\t\t", "012\t\t", "012", "012"},
- {"\t012\t", "012\t", "\t012", "012"},
- {"012", "012", "012", "012"},
- {"012\r\n", "012\r\n", "012", "012"},
- {"\n012\r", "012\r", "\n012", "012"},
- {"\n \t\r", "", "", ""},
- {"", "", "", ""},
- {"abc", "abc", "abc", "abc"},
- {"a c", "a c", "a c", "a c"},
- };
+ };
+ static const TTest tests[] = {
+ {" 012 ", "012 ", " 012", "012"},
+ {" 012", "012", " 012", "012"},
+ {"012\t\t", "012\t\t", "012", "012"},
+ {"\t012\t", "012\t", "\t012", "012"},
+ {"012", "012", "012", "012"},
+ {"012\r\n", "012\r\n", "012", "012"},
+ {"\n012\r", "012\r", "\n012", "012"},
+ {"\n \t\r", "", "", ""},
+ {"", "", "", ""},
+ {"abc", "abc", "abc", "abc"},
+ {"a c", "a c", "a c", "a c"},
+ };
for (const auto& test : tests) {
TString inputStr(test.Str);
@@ -45,16 +45,16 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
}
Y_UNIT_TEST(TestCustomStrip) {
- struct TTest {
+ struct TTest {
const char* Str;
const char* Result;
- };
- static const TTest tests[] = {
- {"//012//", "012"},
- {"//012", "012"},
- {"012", "012"},
- {"012//", "012"},
- };
+ };
+ static const TTest tests[] = {
+ {"//012//", "012"},
+ {"//012", "012"},
+ {"012", "012"},
+ {"012//", "012"},
+ };
for (auto test : tests) {
UNIT_ASSERT_EQUAL(
@@ -64,28 +64,28 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
}
Y_UNIT_TEST(TestCustomStripLeftRight) {
- struct TTest {
- const char* Str;
- const char* ResultLeft;
- const char* ResultRight;
- };
- static const TTest tests[] = {
- {"//012//", "012//", "//012"},
- {"//012", "012", "//012"},
- {"012", "012", "012"},
- {"012//", "012//", "012"},
- };
-
+ struct TTest {
+ const char* Str;
+ const char* ResultLeft;
+ const char* ResultRight;
+ };
+ static const TTest tests[] = {
+ {"//012//", "012//", "//012"},
+ {"//012", "012", "//012"},
+ {"012", "012", "012"},
+ {"012//", "012//", "012"},
+ };
+
for (const auto& test : tests) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
StripStringLeft(TString(test.Str), EqualsStripAdapter('/')),
test.ResultLeft);
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
StripStringRight(TString(test.Str), EqualsStripAdapter('/')),
test.ResultRight);
- };
- }
-
+ };
+ }
+
Y_UNIT_TEST(TestNullStringStrip) {
TStringBuf nullString(nullptr, nullptr);
UNIT_ASSERT_EQUAL(
@@ -128,11 +128,11 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
TString abs1("Very long description string written in unknown language.");
TString abs2(abs1);
TString abs3(abs1);
- CollapseText(abs1, 204);
- CollapseText(abs2, 54);
- CollapseText(abs3, 49);
- UNIT_ASSERT_EQUAL(abs1 == "Very long description string written in unknown language.", true);
- UNIT_ASSERT_EQUAL(abs2 == "Very long description string written in unknown ...", true);
- UNIT_ASSERT_EQUAL(abs3 == "Very long description string written in ...", true);
+ CollapseText(abs1, 204);
+ CollapseText(abs2, 54);
+ CollapseText(abs3, 49);
+ UNIT_ASSERT_EQUAL(abs1 == "Very long description string written in unknown language.", true);
+ UNIT_ASSERT_EQUAL(abs2 == "Very long description string written in unknown ...", true);
+ UNIT_ASSERT_EQUAL(abs3 == "Very long description string written in ...", true);
}
}