diff options
author | babenko <babenko@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
commit | f31097c96270919a1f49360bdaaa69ea4f3fefab (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/string/unittests/guid_ut.cpp | |
parent | cec37806d8847aa3db53bafc9e251d4aaf325c12 (diff) | |
download | ydb-f31097c96270919a1f49360bdaaa69ea4f3fefab.tar.gz |
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/string/unittests/guid_ut.cpp')
-rw-r--r-- | library/cpp/yt/string/unittests/guid_ut.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
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 |