aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/string/unittests
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.ru>2022-02-10 16:49:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:19 +0300
commitf31097c96270919a1f49360bdaaa69ea4f3fefab (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/string/unittests
parentcec37806d8847aa3db53bafc9e251d4aaf325c12 (diff)
downloadydb-f31097c96270919a1f49360bdaaa69ea4f3fefab.tar.gz
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/string/unittests')
-rw-r--r--library/cpp/yt/string/unittests/enum_ut.cpp114
-rw-r--r--library/cpp/yt/string/unittests/format_ut.cpp278
-rw-r--r--library/cpp/yt/string/unittests/guid_ut.cpp80
-rw-r--r--library/cpp/yt/string/unittests/string_ut.cpp102
-rw-r--r--library/cpp/yt/string/unittests/ya.make2
5 files changed, 288 insertions, 288 deletions
diff --git a/library/cpp/yt/string/unittests/enum_ut.cpp b/library/cpp/yt/string/unittests/enum_ut.cpp
index 948a0dd000..b8076fd8ee 100644
--- a/library/cpp/yt/string/unittests/enum_ut.cpp
+++ b/library/cpp/yt/string/unittests/enum_ut.cpp
@@ -1,61 +1,61 @@
#include <library/cpp/testing/gtest/gtest.h>
-
+
#include <library/cpp/yt/string/enum.h>
#include <library/cpp/yt/string/format.h>
-
-#include <limits>
-
-namespace NYT {
-namespace {
-
-////////////////////////////////////////////////////////////////////////////////
-
-// Some compile-time sanity checks.
-DEFINE_ENUM(ESample, (One)(Two));
-static_assert(TFormatTraits<ESample>::HasCustomFormatValue);
-static_assert(TFormatTraits<TEnumIndexedVector<ESample, int>>::HasCustomFormatValue);
-
-DEFINE_ENUM(EColor,
- (Red)
- (BlackAndWhite)
-);
-
-DEFINE_BIT_ENUM(ELangs,
- ((None) (0x00))
- ((Cpp) (0x01))
- ((Go) (0x02))
- ((Rust) (0x04))
- ((Python) (0x08))
- ((JavaScript) (0x10))
-)
-
-TEST(TFormatTest, Enum)
-{
- EXPECT_EQ("Red", Format("%v", EColor::Red));
- EXPECT_EQ("red", Format("%lv", EColor::Red));
-
- EXPECT_EQ("BlackAndWhite", Format("%v", EColor::BlackAndWhite));
- EXPECT_EQ("black_and_white", Format("%lv", EColor::BlackAndWhite));
-
- EXPECT_EQ("EColor(100)", Format("%v", EColor(100)));
-
- EXPECT_EQ("JavaScript", Format("%v", ELangs::JavaScript));
- EXPECT_EQ("java_script", Format("%lv", ELangs::JavaScript));
-
- EXPECT_EQ("None", Format("%v", ELangs::None));
- EXPECT_EQ("none", Format("%lv", ELangs::None));
-
- EXPECT_EQ("Cpp | Go", Format("%v", ELangs::Cpp | ELangs::Go));
- EXPECT_EQ("cpp | go", Format("%lv", ELangs::Cpp | ELangs::Go));
-
- auto four = ELangs::Cpp | ELangs::Go | ELangs::Python | ELangs::JavaScript;
- EXPECT_EQ("Cpp | Go | Python | JavaScript", Format("%v", four));
- EXPECT_EQ("cpp | go | python | java_script", Format("%lv", four));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace
-} // namespace NYT
-
+
+#include <limits>
+
+namespace NYT {
+namespace {
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Some compile-time sanity checks.
+DEFINE_ENUM(ESample, (One)(Two));
+static_assert(TFormatTraits<ESample>::HasCustomFormatValue);
+static_assert(TFormatTraits<TEnumIndexedVector<ESample, int>>::HasCustomFormatValue);
+
+DEFINE_ENUM(EColor,
+ (Red)
+ (BlackAndWhite)
+);
+
+DEFINE_BIT_ENUM(ELangs,
+ ((None) (0x00))
+ ((Cpp) (0x01))
+ ((Go) (0x02))
+ ((Rust) (0x04))
+ ((Python) (0x08))
+ ((JavaScript) (0x10))
+)
+
+TEST(TFormatTest, Enum)
+{
+ EXPECT_EQ("Red", Format("%v", EColor::Red));
+ EXPECT_EQ("red", Format("%lv", EColor::Red));
+
+ EXPECT_EQ("BlackAndWhite", Format("%v", EColor::BlackAndWhite));
+ EXPECT_EQ("black_and_white", Format("%lv", EColor::BlackAndWhite));
+
+ EXPECT_EQ("EColor(100)", Format("%v", EColor(100)));
+
+ EXPECT_EQ("JavaScript", Format("%v", ELangs::JavaScript));
+ EXPECT_EQ("java_script", Format("%lv", ELangs::JavaScript));
+
+ EXPECT_EQ("None", Format("%v", ELangs::None));
+ EXPECT_EQ("none", Format("%lv", ELangs::None));
+
+ EXPECT_EQ("Cpp | Go", Format("%v", ELangs::Cpp | ELangs::Go));
+ EXPECT_EQ("cpp | go", Format("%lv", ELangs::Cpp | ELangs::Go));
+
+ auto four = ELangs::Cpp | ELangs::Go | ELangs::Python | ELangs::JavaScript;
+ EXPECT_EQ("Cpp | Go | Python | JavaScript", Format("%v", four));
+ EXPECT_EQ("cpp | go | python | java_script", Format("%lv", four));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace
+} // namespace NYT
+
diff --git a/library/cpp/yt/string/unittests/format_ut.cpp b/library/cpp/yt/string/unittests/format_ut.cpp
index 58c757be0d..ee069bb2c0 100644
--- a/library/cpp/yt/string/unittests/format_ut.cpp
+++ b/library/cpp/yt/string/unittests/format_ut.cpp
@@ -1,149 +1,149 @@
#include <library/cpp/testing/gtest/gtest.h>
-
-#include <library/cpp/yt/string/format.h>
-
+
+#include <library/cpp/yt/string/format.h>
+
#include <library/cpp/yt/small_containers/compact_vector.h>
-#include <limits>
-
-namespace NYT {
-namespace {
-
-////////////////////////////////////////////////////////////////////////////////
-
-// Some compile-time sanity checks.
-static_assert(TFormatTraits<int>::HasCustomFormatValue);
-static_assert(TFormatTraits<double>::HasCustomFormatValue);
-static_assert(TFormatTraits<void*>::HasCustomFormatValue);
-static_assert(TFormatTraits<const char*>::HasCustomFormatValue);
-static_assert(TFormatTraits<TStringBuf>::HasCustomFormatValue);
-static_assert(TFormatTraits<TString>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::vector<int>>::HasCustomFormatValue);
+#include <limits>
+
+namespace NYT {
+namespace {
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Some compile-time sanity checks.
+static_assert(TFormatTraits<int>::HasCustomFormatValue);
+static_assert(TFormatTraits<double>::HasCustomFormatValue);
+static_assert(TFormatTraits<void*>::HasCustomFormatValue);
+static_assert(TFormatTraits<const char*>::HasCustomFormatValue);
+static_assert(TFormatTraits<TStringBuf>::HasCustomFormatValue);
+static_assert(TFormatTraits<TString>::HasCustomFormatValue);
+static_assert(TFormatTraits<std::vector<int>>::HasCustomFormatValue);
// N.B. TCompactVector<int, 1> is not buildable on Windows
static_assert(TFormatTraits<TCompactVector<int, 2>>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::set<int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::map<int, int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::multimap<int, int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<THashSet<int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<THashMap<int, int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<THashMultiSet<int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::pair<int, int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<std::optional<int>>::HasCustomFormatValue);
-static_assert(TFormatTraits<TDuration>::HasCustomFormatValue);
-static_assert(TFormatTraits<TInstant>::HasCustomFormatValue);
-
-struct TUnformattable
-{ };
-static_assert(!TFormatTraits<TUnformattable>::HasCustomFormatValue);
-
-////////////////////////////////////////////////////////////////////////////////
-
-TEST(TFormatTest, Nothing)
-{
- EXPECT_EQ("abc", Format("a%nb%nc", 1, 2));
-}
-
-TEST(TFormatTest, Verbatim)
-{
- EXPECT_EQ("", Format(""));
- EXPECT_EQ("test", Format("test"));
- EXPECT_EQ("%", Format("%%"));
- EXPECT_EQ("%hello%world%", Format("%%hello%%world%%"));
-}
-
-TEST(TFormatTest, MultipleArgs)
-{
- EXPECT_EQ("2+2=4", Format("%v+%v=%v", 2, 2, 4));
-}
-
-TEST(TFormatTest, Strings)
-{
- EXPECT_EQ("test", Format("%s", "test"));
- EXPECT_EQ("test", Format("%s", TStringBuf("test")));
- EXPECT_EQ("test", Format("%s", TString("test")));
-
- EXPECT_EQ(" abc", Format("%6s", TString("abc")));
- EXPECT_EQ("abc ", Format("%-6s", TString("abc")));
- EXPECT_EQ(" abc", Format("%10v", TString("abc")));
- EXPECT_EQ("abc ", Format("%-10v", TString("abc")));
- EXPECT_EQ("abc", Format("%2s", TString("abc")));
- EXPECT_EQ("abc", Format("%-2s", TString("abc")));
- EXPECT_EQ("abc", Format("%0s", TString("abc")));
- EXPECT_EQ("abc", Format("%-0s", TString("abc")));
+static_assert(TFormatTraits<std::set<int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<std::map<int, int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<std::multimap<int, int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<THashSet<int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<THashMap<int, int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<THashMultiSet<int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<std::pair<int, int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<std::optional<int>>::HasCustomFormatValue);
+static_assert(TFormatTraits<TDuration>::HasCustomFormatValue);
+static_assert(TFormatTraits<TInstant>::HasCustomFormatValue);
+
+struct TUnformattable
+{ };
+static_assert(!TFormatTraits<TUnformattable>::HasCustomFormatValue);
+
+////////////////////////////////////////////////////////////////////////////////
+
+TEST(TFormatTest, Nothing)
+{
+ EXPECT_EQ("abc", Format("a%nb%nc", 1, 2));
+}
+
+TEST(TFormatTest, Verbatim)
+{
+ EXPECT_EQ("", Format(""));
+ EXPECT_EQ("test", Format("test"));
+ EXPECT_EQ("%", Format("%%"));
+ EXPECT_EQ("%hello%world%", Format("%%hello%%world%%"));
+}
+
+TEST(TFormatTest, MultipleArgs)
+{
+ EXPECT_EQ("2+2=4", Format("%v+%v=%v", 2, 2, 4));
+}
+
+TEST(TFormatTest, Strings)
+{
+ EXPECT_EQ("test", Format("%s", "test"));
+ EXPECT_EQ("test", Format("%s", TStringBuf("test")));
+ EXPECT_EQ("test", Format("%s", TString("test")));
+
+ EXPECT_EQ(" abc", Format("%6s", TString("abc")));
+ EXPECT_EQ("abc ", Format("%-6s", TString("abc")));
+ EXPECT_EQ(" abc", Format("%10v", TString("abc")));
+ EXPECT_EQ("abc ", Format("%-10v", TString("abc")));
+ EXPECT_EQ("abc", Format("%2s", TString("abc")));
+ EXPECT_EQ("abc", Format("%-2s", TString("abc")));
+ EXPECT_EQ("abc", Format("%0s", TString("abc")));
+ EXPECT_EQ("abc", Format("%-0s", TString("abc")));
EXPECT_EQ(100, std::ssize(Format("%100v", "abc")));
-}
-
-TEST(TFormatTest, Integers)
-{
- EXPECT_EQ("123", Format("%d", 123));
- EXPECT_EQ("123", Format("%v", 123));
-
+}
+
+TEST(TFormatTest, Integers)
+{
+ EXPECT_EQ("123", Format("%d", 123));
+ EXPECT_EQ("123", Format("%v", 123));
+
EXPECT_EQ("042", Format("%03d", 42));
EXPECT_EQ("42", Format("%01d", 42));
- EXPECT_EQ("2147483647", Format("%d", std::numeric_limits<i32>::max()));
- EXPECT_EQ("-2147483648", Format("%d", std::numeric_limits<i32>::min()));
-
- EXPECT_EQ("0", Format("%u", 0U));
- EXPECT_EQ("0", Format("%v", 0U));
- EXPECT_EQ("4294967295", Format("%u", std::numeric_limits<ui32>::max()));
- EXPECT_EQ("4294967295", Format("%v", std::numeric_limits<ui32>::max()));
-
- EXPECT_EQ("9223372036854775807", Format("%" PRId64, std::numeric_limits<i64>::max()));
- EXPECT_EQ("9223372036854775807", Format("%v", std::numeric_limits<i64>::max()));
- EXPECT_EQ("-9223372036854775808", Format("%" PRId64, std::numeric_limits<i64>::min()));
- EXPECT_EQ("-9223372036854775808", Format("%v", std::numeric_limits<i64>::min()));
-
- EXPECT_EQ("0", Format("%" PRIu64, 0ULL));
- EXPECT_EQ("0", Format("%v", 0ULL));
- EXPECT_EQ("18446744073709551615", Format("%" PRIu64, std::numeric_limits<ui64>::max()));
- EXPECT_EQ("18446744073709551615", Format("%v", std::numeric_limits<ui64>::max()));
-}
-
-TEST(TFormatTest, Floats)
-{
- EXPECT_EQ("3.14", Format("%.2f", 3.1415F));
- EXPECT_EQ("3.14", Format("%.2v", 3.1415F));
- EXPECT_EQ("3.14", Format("%.2lf", 3.1415));
- EXPECT_EQ("3.14", Format("%.2v", 3.1415));
- EXPECT_EQ(TString(std::to_string(std::numeric_limits<double>::max())),
- Format("%lF", std::numeric_limits<double>::max()));
-}
-
-TEST(TFormatTest, Bool)
-{
- EXPECT_EQ("True", Format("%v", true));
- EXPECT_EQ("False", Format("%v", false));
- EXPECT_EQ("true", Format("%lv", true));
- EXPECT_EQ("false", Format("%lv", false));
-}
-
-TEST(TFormatTest, Quotes)
-{
- EXPECT_EQ("\"True\"", Format("%Qv", true));
- EXPECT_EQ("'False'", Format("%qv", false));
- EXPECT_EQ("'\\\'\"'", Format("%qv", "\'\""));
- EXPECT_EQ("\"\\x01\"", Format("%Qv", "\x1"));
- EXPECT_EQ("'\\x1b'", Format("%qv", '\x1b'));
-}
-
-TEST(TFormatTest, Nullable)
-{
- EXPECT_EQ("1", Format("%v", std::make_optional<int>(1)));
- EXPECT_EQ("<null>", Format("%v", std::nullopt));
- EXPECT_EQ("<null>", Format("%v", std::optional<int>()));
- EXPECT_EQ("3.14", Format("%.2f", std::optional<double>(3.1415)));
-}
-
-TEST(TFormatTest, Pointers)
-{
- // No idea if pointer format is standardized, check against Sprintf.
- auto p = reinterpret_cast<void*>(123);
- EXPECT_EQ(Sprintf("%p", reinterpret_cast<void*>(123)), Format("%p", p));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace
-} // namespace NYT
+ EXPECT_EQ("2147483647", Format("%d", std::numeric_limits<i32>::max()));
+ EXPECT_EQ("-2147483648", Format("%d", std::numeric_limits<i32>::min()));
+
+ EXPECT_EQ("0", Format("%u", 0U));
+ EXPECT_EQ("0", Format("%v", 0U));
+ EXPECT_EQ("4294967295", Format("%u", std::numeric_limits<ui32>::max()));
+ EXPECT_EQ("4294967295", Format("%v", std::numeric_limits<ui32>::max()));
+
+ EXPECT_EQ("9223372036854775807", Format("%" PRId64, std::numeric_limits<i64>::max()));
+ EXPECT_EQ("9223372036854775807", Format("%v", std::numeric_limits<i64>::max()));
+ EXPECT_EQ("-9223372036854775808", Format("%" PRId64, std::numeric_limits<i64>::min()));
+ EXPECT_EQ("-9223372036854775808", Format("%v", std::numeric_limits<i64>::min()));
+
+ EXPECT_EQ("0", Format("%" PRIu64, 0ULL));
+ EXPECT_EQ("0", Format("%v", 0ULL));
+ EXPECT_EQ("18446744073709551615", Format("%" PRIu64, std::numeric_limits<ui64>::max()));
+ EXPECT_EQ("18446744073709551615", Format("%v", std::numeric_limits<ui64>::max()));
+}
+
+TEST(TFormatTest, Floats)
+{
+ EXPECT_EQ("3.14", Format("%.2f", 3.1415F));
+ EXPECT_EQ("3.14", Format("%.2v", 3.1415F));
+ EXPECT_EQ("3.14", Format("%.2lf", 3.1415));
+ EXPECT_EQ("3.14", Format("%.2v", 3.1415));
+ EXPECT_EQ(TString(std::to_string(std::numeric_limits<double>::max())),
+ Format("%lF", std::numeric_limits<double>::max()));
+}
+
+TEST(TFormatTest, Bool)
+{
+ EXPECT_EQ("True", Format("%v", true));
+ EXPECT_EQ("False", Format("%v", false));
+ EXPECT_EQ("true", Format("%lv", true));
+ EXPECT_EQ("false", Format("%lv", false));
+}
+
+TEST(TFormatTest, Quotes)
+{
+ EXPECT_EQ("\"True\"", Format("%Qv", true));
+ EXPECT_EQ("'False'", Format("%qv", false));
+ EXPECT_EQ("'\\\'\"'", Format("%qv", "\'\""));
+ EXPECT_EQ("\"\\x01\"", Format("%Qv", "\x1"));
+ EXPECT_EQ("'\\x1b'", Format("%qv", '\x1b'));
+}
+
+TEST(TFormatTest, Nullable)
+{
+ EXPECT_EQ("1", Format("%v", std::make_optional<int>(1)));
+ EXPECT_EQ("<null>", Format("%v", std::nullopt));
+ EXPECT_EQ("<null>", Format("%v", std::optional<int>()));
+ EXPECT_EQ("3.14", Format("%.2f", std::optional<double>(3.1415)));
+}
+
+TEST(TFormatTest, Pointers)
+{
+ // No idea if pointer format is standardized, check against Sprintf.
+ auto p = reinterpret_cast<void*>(123);
+ EXPECT_EQ(Sprintf("%p", reinterpret_cast<void*>(123)), Format("%p", p));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace
+} // namespace NYT
diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp
index b63c45d322..4b5eebea16 100644
--- a/library/cpp/yt/string/unittests/guid_ut.cpp
+++ b/library/cpp/yt/string/unittests/guid_ut.cpp
@@ -1,49 +1,49 @@
#include <library/cpp/testing/gtest/gtest.h>
-
+
#include <library/cpp/yt/string/guid.h>
#include <library/cpp/yt/string/format.h>
-
+
#include <util/string/hex.h>
-namespace NYT {
-namespace {
-
-////////////////////////////////////////////////////////////////////////////////
-
+namespace NYT {
+namespace {
+
+////////////////////////////////////////////////////////////////////////////////
+
static_assert(TFormatTraits<TGuid>::HasCustomFormatValue);
-
-TString CanonicalToString(TGuid value)
-{
- return Sprintf("%x-%x-%x-%x",
- value.Parts32[3],
- value.Parts32[2],
- value.Parts32[1],
- value.Parts32[0]);
-}
-
+
+TString CanonicalToString(TGuid value)
+{
+ return Sprintf("%x-%x-%x-%x",
+ value.Parts32[3],
+ value.Parts32[2],
+ value.Parts32[1],
+ value.Parts32[0]);
+}
+
const ui32 TrickyValues[] = {
0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678
};
-TEST(TGuidTest, FormatAllTricky)
-{
- for (ui32 a : TrickyValues) {
- for (ui32 b : TrickyValues) {
- for (ui32 c : TrickyValues) {
- for (ui32 d : TrickyValues) {
- auto value = TGuid(a, b, c, d);
- EXPECT_EQ(CanonicalToString(value), ToString(value));
- }
- }
- }
- }
-}
-
-TEST(TGuidTest, FormatAllSymbols)
-{
- const auto Value = TGuid::FromString("12345678-abcdef01-12345678-abcdef01");
- EXPECT_EQ(CanonicalToString(Value), ToString(Value));
-}
+TEST(TGuidTest, FormatAllTricky)
+{
+ for (ui32 a : TrickyValues) {
+ for (ui32 b : TrickyValues) {
+ for (ui32 c : TrickyValues) {
+ for (ui32 d : TrickyValues) {
+ auto value = TGuid(a, b, c, d);
+ EXPECT_EQ(CanonicalToString(value), ToString(value));
+ }
+ }
+ }
+ }
+}
+
+TEST(TGuidTest, FormatAllSymbols)
+{
+ const auto Value = TGuid::FromString("12345678-abcdef01-12345678-abcdef01");
+ EXPECT_EQ(CanonicalToString(Value), ToString(Value));
+}
TEST(TGuidTest, ByteOrder)
{
@@ -52,7 +52,7 @@ TEST(TGuidTest, ByteOrder)
EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412");
}
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace
-} // namespace NYT
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace
+} // namespace NYT
diff --git a/library/cpp/yt/string/unittests/string_ut.cpp b/library/cpp/yt/string/unittests/string_ut.cpp
index 758c804b8a..3e12312af0 100644
--- a/library/cpp/yt/string/unittests/string_ut.cpp
+++ b/library/cpp/yt/string/unittests/string_ut.cpp
@@ -1,52 +1,52 @@
#include <library/cpp/testing/gtest/gtest.h>
-
-#include <library/cpp/yt/string/string.h>
-
-namespace NYT {
-namespace {
-
-////////////////////////////////////////////////////////////////////////////////
-
-struct TTestCase
-{
- const char* UnderCase;
- const char* CamelCase;
-};
-
-static std::vector<TTestCase> TestCases {
- { "kenny", "Kenny" },
- { "south_park", "SouthPark" },
- { "a", "A" },
- { "a_b_c", "ABC" },
- { "reed_solomon_6_3", "ReedSolomon_6_3" },
- { "lrc_12_2_2", "Lrc_12_2_2" },
- { "0", "0" },
- { "0_1_2", "0_1_2" },
- { "int64", "Int64" }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-TEST(TStringTest, UnderscoreCaseToCamelCase)
-{
- for (const auto& testCase : TestCases) {
- auto result = UnderscoreCaseToCamelCase(testCase.UnderCase);
- EXPECT_STREQ(testCase.CamelCase, result.c_str())
- << "Original: \"" << testCase.UnderCase << '"';
- }
-}
-
-TEST(TStringTest, CamelCaseToUnderscoreCase)
-{
- for (const auto& testCase : TestCases) {
- auto result = CamelCaseToUnderscoreCase(testCase.CamelCase);
- EXPECT_STREQ(testCase.UnderCase, result.c_str())
- << "Original: \"" << testCase.CamelCase << '"';
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace
-} // namespace NYT
-
+
+#include <library/cpp/yt/string/string.h>
+
+namespace NYT {
+namespace {
+
+////////////////////////////////////////////////////////////////////////////////
+
+struct TTestCase
+{
+ const char* UnderCase;
+ const char* CamelCase;
+};
+
+static std::vector<TTestCase> TestCases {
+ { "kenny", "Kenny" },
+ { "south_park", "SouthPark" },
+ { "a", "A" },
+ { "a_b_c", "ABC" },
+ { "reed_solomon_6_3", "ReedSolomon_6_3" },
+ { "lrc_12_2_2", "Lrc_12_2_2" },
+ { "0", "0" },
+ { "0_1_2", "0_1_2" },
+ { "int64", "Int64" }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+TEST(TStringTest, UnderscoreCaseToCamelCase)
+{
+ for (const auto& testCase : TestCases) {
+ auto result = UnderscoreCaseToCamelCase(testCase.UnderCase);
+ EXPECT_STREQ(testCase.CamelCase, result.c_str())
+ << "Original: \"" << testCase.UnderCase << '"';
+ }
+}
+
+TEST(TStringTest, CamelCaseToUnderscoreCase)
+{
+ for (const auto& testCase : TestCases) {
+ auto result = CamelCaseToUnderscoreCase(testCase.CamelCase);
+ EXPECT_STREQ(testCase.UnderCase, result.c_str())
+ << "Original: \"" << testCase.CamelCase << '"';
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace
+} // namespace NYT
+
diff --git a/library/cpp/yt/string/unittests/ya.make b/library/cpp/yt/string/unittests/ya.make
index 51c85eea4c..9d539758d1 100644
--- a/library/cpp/yt/string/unittests/ya.make
+++ b/library/cpp/yt/string/unittests/ya.make
@@ -10,7 +10,7 @@ SRCS(
)
PEERDIR(
- library/cpp/yt/string
+ library/cpp/yt/string
library/cpp/testing/gtest
)