diff options
author | stanly <stanly@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
commit | cde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch) | |
tree | d3349caea4095825a55b5ba24fe758067b29ce6f /util/string | |
parent | 9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff) | |
download | ydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz |
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string')
-rw-r--r-- | util/string/ascii.h | 34 | ||||
-rw-r--r-- | util/string/ascii_ut.cpp | 20 | ||||
-rw-r--r-- | util/string/printf_ut.cpp | 8 |
3 files changed, 31 insertions, 31 deletions
diff --git a/util/string/ascii.h b/util/string/ascii.h index 10344384d3..f40482f679 100644 --- a/util/string/ascii.h +++ b/util/string/ascii.h @@ -212,8 +212,8 @@ static inline int AsciiCompareIgnoreCase(const char* s1, const char* s2) noexcep * similar to stricmp. */ Y_PURE_FUNCTION int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept; - -/** + +/** * ASCII case-sensitive string comparison (for proper UTF8 strings * case-sensitive comparison consider using @c library/cpp/charset). * @@ -224,24 +224,24 @@ Y_PURE_FUNCTION int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf */ static inline bool AsciiHasPrefix(const TStringBuf s1, const TStringBuf s2) noexcept { return (s1.size() >= s2.size()) && memcmp(s1.data(), s2.data(), s2.size()) == 0; -} - -/** - * ASCII case-insensitive string comparison (for proper UTF8 strings +} + +/** + * ASCII case-insensitive string comparison (for proper UTF8 strings * case-insensitive comparison consider using @c library/cpp/charset). - * - * @return true iff @c s2 are case-insensitively prefix of @c s1. - */ + * + * @return true iff @c s2 are case-insensitively prefix of @c s1. + */ static inline bool AsciiHasPrefixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept { return (s1.size() >= s2.size()) && strnicmp(s1.data(), s2.data(), s2.size()) == 0; -} - -/** - * ASCII case-insensitive string comparison (for proper UTF8 strings +} + +/** + * ASCII case-insensitive string comparison (for proper UTF8 strings * case-insensitive comparison consider using @c library/cpp/charset). - * - * @return true iff @c s2 are case-insensitively suffix of @c s1. - */ + * + * @return true iff @c s2 are case-insensitively suffix of @c s1. + */ static inline bool AsciiHasSuffixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept { return (s1.size() >= s2.size()) && strnicmp((s1.data() + (s1.size() - s2.size())), s2.data(), s2.size()) == 0; -} +} diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp index 89069fee50..b35dc835ad 100644 --- a/util/string/ascii_ut.cpp +++ b/util/string/ascii_ut.cpp @@ -84,15 +84,15 @@ Y_UNIT_TEST_SUITE(TAsciiTest) { UNIT_ASSERT(AsciiCompareIgnoreCase("qqQ", "qq") > 0); UNIT_ASSERT(AsciiCompareIgnoreCase("qq", "qq") == 0); - - UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qwe"), true); - UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qWe"), false); - UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "eWq"), false); - - UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "qWe"), true); - UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "eWq"), false); - - UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "asD"), true); - UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "ast"), false); + + UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qwe"), true); + UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qWe"), false); + UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "eWq"), false); + + UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "qWe"), true); + UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "eWq"), false); + + UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "asD"), true); + UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "ast"), false); } } diff --git a/util/string/printf_ut.cpp b/util/string/printf_ut.cpp index 2b2f980b70..d11129b6b0 100644 --- a/util/string/printf_ut.cpp +++ b/util/string/printf_ut.cpp @@ -21,10 +21,10 @@ Y_UNIT_TEST_SUITE(TStringPrintf) { } Y_UNIT_TEST(TestSpecial) { - UNIT_ASSERT_EQUAL("4294967295", Sprintf("%" PRIu32, (ui32)(-1))); + UNIT_ASSERT_EQUAL("4294967295", Sprintf("%" PRIu32, (ui32)(-1))); } - + Y_UNIT_TEST(TestExplicitPositions) { - UNIT_ASSERT_EQUAL("abc xyz abc", Sprintf("%1$s %2$s %1$s", "abc", "xyz")); - } + UNIT_ASSERT_EQUAL("abc xyz abc", Sprintf("%1$s %2$s %1$s", "abc", "xyz")); + } } |