aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/coding
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2025-02-22 17:28:25 +0300
committerbabenko <babenko@yandex-team.com>2025-02-22 17:48:29 +0300
commit59afaa0cb7cd89146dd10f5446256afcce33bd0e (patch)
tree38d3c46bcba8da7c3b8ffc6b818695bc6b62d532 /library/cpp/yt/coding
parent1d9cc117e33b162a5247032e175ed7ea26971437 (diff)
downloadydb-59afaa0cb7cd89146dd10f5446256afcce33bd0e.tar.gz
YT-22593: More trivial TString->std::string migrations
[nodiff:runtime] commit_hash:1ba799aed1703ab7c6304b6da7090b3337f768dd
Diffstat (limited to 'library/cpp/yt/coding')
-rw-r--r--library/cpp/yt/coding/unittests/varint_ut.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/library/cpp/yt/coding/unittests/varint_ut.cpp b/library/cpp/yt/coding/unittests/varint_ut.cpp
index ed83ab5c92..cb6a800311 100644
--- a/library/cpp/yt/coding/unittests/varint_ut.cpp
+++ b/library/cpp/yt/coding/unittests/varint_ut.cpp
@@ -15,13 +15,14 @@ using ::testing::Values;
////////////////////////////////////////////////////////////////////////////////
-class TWriteVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
+class TWriteVarIntTest
+ : public ::testing::TestWithParam<std::tuple<ui64, std::string>>
{ };
TEST_P(TWriteVarIntTest, Serialization)
{
ui64 value = std::get<0>(GetParam());
- TString rightAnswer = std::get<1>(GetParam());
+ std::string rightAnswer = std::get<1>(GetParam());
TStringStream outputStream;
WriteVarUint64(&outputStream, value);
@@ -30,13 +31,13 @@ TEST_P(TWriteVarIntTest, Serialization)
////////////////////////////////////////////////////////////////////////////////
-class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
+class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, std::string> >
{ };
TEST_P(TReadVarIntTest, Serialization)
{
ui64 rightAnswer = std::get<0>(GetParam());
- TString input = std::get<1>(GetParam());
+ auto input = TString(std::get<1>(GetParam()));
TStringInput inputStream(input);
ui64 value;
@@ -56,34 +57,34 @@ TEST(TReadVarIntTest, Overflow)
auto ValuesForVarIntTests = Values(
// Simple cases.
- std::make_tuple(0x0ull, TString("\x00", 1)),
- std::make_tuple(0x1ull, TString("\x01", 1)),
- std::make_tuple(0x2ull, TString("\x02", 1)),
- std::make_tuple(0x3ull, TString("\x03", 1)),
- std::make_tuple(0x4ull, TString("\x04", 1)),
+ std::make_tuple(0x0ull, std::string("\x00", 1)),
+ std::make_tuple(0x1ull, std::string("\x01", 1)),
+ std::make_tuple(0x2ull, std::string("\x02", 1)),
+ std::make_tuple(0x3ull, std::string("\x03", 1)),
+ std::make_tuple(0x4ull, std::string("\x04", 1)),
// The following "magic numbers" are critical points for varint encoding.
- std::make_tuple((1ull << 7) - 1, TString("\x7f", 1)),
- std::make_tuple((1ull << 7), TString("\x80\x01", 2)),
- std::make_tuple((1ull << 14) - 1, TString("\xff\x7f", 2)),
- std::make_tuple((1ull << 14), TString("\x80\x80\x01", 3)),
- std::make_tuple((1ull << 21) - 1, TString("\xff\xff\x7f", 3)),
- std::make_tuple((1ull << 21), TString("\x80\x80\x80\x01", 4)),
- std::make_tuple((1ull << 28) - 1, TString("\xff\xff\xff\x7f", 4)),
- std::make_tuple((1ull << 28), TString("\x80\x80\x80\x80\x01", 5)),
- std::make_tuple((1ull << 35) - 1, TString("\xff\xff\xff\xff\x7f", 5)),
- std::make_tuple((1ull << 35), TString("\x80\x80\x80\x80\x80\x01", 6)),
- std::make_tuple((1ull << 42) - 1, TString("\xff\xff\xff\xff\xff\x7f", 6)),
- std::make_tuple((1ull << 42), TString("\x80\x80\x80\x80\x80\x80\x01", 7)),
- std::make_tuple((1ull << 49) - 1, TString("\xff\xff\xff\xff\xff\xff\x7f", 7)),
- std::make_tuple((1ull << 49), TString("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
- std::make_tuple((1ull << 56) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
- std::make_tuple((1ull << 56), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
- std::make_tuple((1ull << 63) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
- std::make_tuple((1ull << 63), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
+ std::make_tuple((1ull << 7) - 1, std::string("\x7f", 1)),
+ std::make_tuple((1ull << 7), std::string("\x80\x01", 2)),
+ std::make_tuple((1ull << 14) - 1, std::string("\xff\x7f", 2)),
+ std::make_tuple((1ull << 14), std::string("\x80\x80\x01", 3)),
+ std::make_tuple((1ull << 21) - 1, std::string("\xff\xff\x7f", 3)),
+ std::make_tuple((1ull << 21), std::string("\x80\x80\x80\x01", 4)),
+ std::make_tuple((1ull << 28) - 1, std::string("\xff\xff\xff\x7f", 4)),
+ std::make_tuple((1ull << 28), std::string("\x80\x80\x80\x80\x01", 5)),
+ std::make_tuple((1ull << 35) - 1, std::string("\xff\xff\xff\xff\x7f", 5)),
+ std::make_tuple((1ull << 35), std::string("\x80\x80\x80\x80\x80\x01", 6)),
+ std::make_tuple((1ull << 42) - 1, std::string("\xff\xff\xff\xff\xff\x7f", 6)),
+ std::make_tuple((1ull << 42), std::string("\x80\x80\x80\x80\x80\x80\x01", 7)),
+ std::make_tuple((1ull << 49) - 1, std::string("\xff\xff\xff\xff\xff\xff\x7f", 7)),
+ std::make_tuple((1ull << 49), std::string("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
+ std::make_tuple((1ull << 56) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
+ std::make_tuple((1ull << 56), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
+ std::make_tuple((1ull << 63) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
+ std::make_tuple((1ull << 63), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
// Boundary case.
- std::make_tuple(static_cast<ui64>(-1), TString("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
+ std::make_tuple(static_cast<ui64>(-1), std::string("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
);
INSTANTIATE_TEST_SUITE_P(ValueParametrized, TWriteVarIntTest,