/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/yt/string/unittests/string_ut.cpp
51 строка
1 KB
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#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