diff options
author | marat-khalili <marat-khalili@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
commit | 4820b82de461ea3ac2dce7c2a77eeda965fffc9c (patch) | |
tree | 22e2f840a95c94ee48844701356e8a10d459b94f /util/generic/string_ut.cpp | |
parent | fcb328858da947c52819d89cea4a4357cc207ae4 (diff) | |
download | ydb-4820b82de461ea3ac2dce7c2a77eeda965fffc9c.tar.gz |
Restoring authorship annotation for <marat-khalili@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/string_ut.cpp')
-rw-r--r-- | util/generic/string_ut.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index ac82e9091d..6d89e8285d 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -294,67 +294,67 @@ protected: // End of block B } - void null_char_of_empty() { - const TStringType s; - - UNIT_ASSERT(s[s.size()] == 0); - } - + void null_char_of_empty() { + const TStringType s; + + UNIT_ASSERT(s[s.size()] == 0); + } + void null_char() { // ISO/IEC 14882:1998(E), ISO/IEC 14882:2003(E), 21.3.4 ('... the const version') const TStringType s(Data_._123456()); UNIT_ASSERT(s[s.size()] == 0); - } - - // Allowed since C++17, see http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2475 - void null_char_assignment_to_subscript_of_empty() { - TStringType s; - -#ifdef TSTRING_IS_STD_STRING - using reference = volatile typename TStringType::value_type&; -#else - using reference = typename TStringType::reference; + } + + // Allowed since C++17, see http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2475 + void null_char_assignment_to_subscript_of_empty() { + TStringType s; + +#ifdef TSTRING_IS_STD_STRING + using reference = volatile typename TStringType::value_type&; +#else + using reference = typename TStringType::reference; #endif - reference trailing_zero = s[s.size()]; - trailing_zero = 0; - UNIT_ASSERT(trailing_zero == 0); + reference trailing_zero = s[s.size()]; + trailing_zero = 0; + UNIT_ASSERT(trailing_zero == 0); } - // Allowed since C++17, see http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2475 - void null_char_assignment_to_subscript_of_nonempty() { - TStringType s(Data_._123456()); - -#ifdef TSTRING_IS_STD_STRING - using reference = volatile typename TStringType::value_type&; -#else - using reference = typename TStringType::reference; -#endif - reference trailing_zero = s[s.size()]; - trailing_zero = 0; - UNIT_ASSERT(trailing_zero == 0); - } - -#ifndef TSTRING_IS_STD_STRING - // Dereferencing string end() is not allowed by C++ standard as of C++20, avoid using in real code. - void null_char_assignment_to_end_of_empty() { - TStringType s; - - volatile auto& trailing_zero = *(s.begin() + s.size()); - trailing_zero = 0; - UNIT_ASSERT(trailing_zero == 0); - } - - // Dereferencing string end() is not allowed by C++ standard as of C++20, avoid using in real code. - void null_char_assignment_to_end_of_nonempty() { - TStringType s(Data_._123456()); - - volatile auto& trailing_zero = *(s.begin() + s.size()); - trailing_zero = 0; - UNIT_ASSERT(trailing_zero == 0); - } -#endif - + // Allowed since C++17, see http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2475 + void null_char_assignment_to_subscript_of_nonempty() { + TStringType s(Data_._123456()); + +#ifdef TSTRING_IS_STD_STRING + using reference = volatile typename TStringType::value_type&; +#else + using reference = typename TStringType::reference; +#endif + reference trailing_zero = s[s.size()]; + trailing_zero = 0; + UNIT_ASSERT(trailing_zero == 0); + } + +#ifndef TSTRING_IS_STD_STRING + // Dereferencing string end() is not allowed by C++ standard as of C++20, avoid using in real code. + void null_char_assignment_to_end_of_empty() { + TStringType s; + + volatile auto& trailing_zero = *(s.begin() + s.size()); + trailing_zero = 0; + UNIT_ASSERT(trailing_zero == 0); + } + + // Dereferencing string end() is not allowed by C++ standard as of C++20, avoid using in real code. + void null_char_assignment_to_end_of_nonempty() { + TStringType s(Data_._123456()); + + volatile auto& trailing_zero = *(s.begin() + s.size()); + trailing_zero = 0; + UNIT_ASSERT(trailing_zero == 0); + } +#endif + void insert() { TStringType strorg = Data_.This_is_test_string_for_string_calls(); TStringType str; @@ -1114,14 +1114,14 @@ public: UNIT_TEST(erase); UNIT_TEST(data); UNIT_TEST(c_str); - UNIT_TEST(null_char_of_empty); + UNIT_TEST(null_char_of_empty); UNIT_TEST(null_char); - UNIT_TEST(null_char_assignment_to_subscript_of_empty); - UNIT_TEST(null_char_assignment_to_subscript_of_nonempty); -#ifndef TSTRING_IS_STD_STRING - UNIT_TEST(null_char_assignment_to_end_of_empty); - UNIT_TEST(null_char_assignment_to_end_of_nonempty); -#endif + UNIT_TEST(null_char_assignment_to_subscript_of_empty); + UNIT_TEST(null_char_assignment_to_subscript_of_nonempty); +#ifndef TSTRING_IS_STD_STRING + UNIT_TEST(null_char_assignment_to_end_of_empty); + UNIT_TEST(null_char_assignment_to_end_of_nonempty); +#endif UNIT_TEST(insert); UNIT_TEST(resize); UNIT_TEST(find); @@ -1150,14 +1150,14 @@ public: UNIT_TEST(erase); UNIT_TEST(data); UNIT_TEST(c_str); - UNIT_TEST(null_char_of_empty); + UNIT_TEST(null_char_of_empty); UNIT_TEST(null_char); - UNIT_TEST(null_char_assignment_to_subscript_of_empty); - UNIT_TEST(null_char_assignment_to_subscript_of_nonempty); -#ifndef TSTRING_IS_STD_STRING - UNIT_TEST(null_char_assignment_to_end_of_empty); - UNIT_TEST(null_char_assignment_to_end_of_nonempty); -#endif + UNIT_TEST(null_char_assignment_to_subscript_of_empty); + UNIT_TEST(null_char_assignment_to_subscript_of_nonempty); +#ifndef TSTRING_IS_STD_STRING + UNIT_TEST(null_char_assignment_to_end_of_empty); + UNIT_TEST(null_char_assignment_to_end_of_nonempty); +#endif UNIT_TEST(insert); UNIT_TEST(resize); UNIT_TEST(find); |