aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorIlnur Khuziev <ilnur.khuziev@yandex.ru>2022-02-10 16:46:13 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:13 +0300
commit736dcd8ca259457a136f2f9f9168c44643914323 (patch)
treeddd46a036d68bfa83aa11b892f31243ea6b068a1 /util/generic
parent9bf2fa2b060c9881d3135c2208c624a1dd546ecc (diff)
downloadydb-736dcd8ca259457a136f2f9f9168c44643914323.tar.gz
Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/adaptor_ut.cpp2
-rw-r--r--util/generic/algorithm_ut.cpp2
-rw-r--r--util/generic/array_ref_ut.cpp2
-rw-r--r--util/generic/array_size_ut.cpp2
-rw-r--r--util/generic/benchmark/fastclp2/main.cpp2
-rw-r--r--util/generic/benchmark/log2/main.cpp2
-rw-r--r--util/generic/benchmark/rotate_bits/main.cpp2
-rw-r--r--util/generic/benchmark/singleton/main.cpp2
-rw-r--r--util/generic/benchmark/smart_pointers/main.cpp2
-rw-r--r--util/generic/benchmark/sort/main.cpp2
-rw-r--r--util/generic/benchmark/vector_count_ctor/f.cpp2
-rw-r--r--util/generic/benchmark/vector_count_ctor/main.cpp2
-rw-r--r--util/generic/bitmap_ut.cpp2
-rw-r--r--util/generic/bitops.h8
-rw-r--r--util/generic/bitops_ut.cpp2
-rw-r--r--util/generic/buffer.cpp28
-rw-r--r--util/generic/buffer.h2
-rw-r--r--util/generic/buffer_ut.cpp2
-rw-r--r--util/generic/cast_ut.cpp2
-rw-r--r--util/generic/deque_ut.cpp2
-rw-r--r--util/generic/explicit_type_ut.cpp2
-rw-r--r--util/generic/flags_ut.cpp2
-rw-r--r--util/generic/function_ut.cpp2
-rw-r--r--util/generic/guid_ut.cpp2
-rw-r--r--util/generic/hash.h6
-rw-r--r--util/generic/hash_primes_ut.cpp2
-rw-r--r--util/generic/hash_set.h4
-rw-r--r--util/generic/hash_ut.cpp2
-rw-r--r--util/generic/intrlist_ut.cpp2
-rw-r--r--util/generic/is_in_ut.cpp2
-rw-r--r--util/generic/iterator_range_ut.cpp2
-rw-r--r--util/generic/iterator_ut.cpp2
-rw-r--r--util/generic/lazy_value_ut.cpp2
-rw-r--r--util/generic/list_ut.cpp2
-rw-r--r--util/generic/map_ut.cpp2
-rw-r--r--util/generic/mapfindptr_ut.cpp2
-rw-r--r--util/generic/maybe_ut.cpp8
-rw-r--r--util/generic/mem_copy_ut.cpp2
-rw-r--r--util/generic/objects_counter_ut.cpp2
-rw-r--r--util/generic/overloaded_ut.cpp2
-rw-r--r--util/generic/ptr.h8
-rw-r--r--util/generic/ptr_ut.cpp2
-rw-r--r--util/generic/queue_ut.cpp2
-rw-r--r--util/generic/reserve.h18
-rw-r--r--util/generic/scope_ut.cpp2
-rw-r--r--util/generic/serialized_enum_ut.cpp2
-rw-r--r--util/generic/set_ut.cpp2
-rw-r--r--util/generic/singleton.cpp14
-rw-r--r--util/generic/singleton_ut.cpp2
-rw-r--r--util/generic/stack_ut.cpp2
-rw-r--r--util/generic/store_policy_ut.cpp2
-rw-r--r--util/generic/strbase.h14
-rw-r--r--util/generic/strbuf_ut.cpp2
-rw-r--r--util/generic/string.cpp38
-rw-r--r--util/generic/string.h4
-rw-r--r--util/generic/string_transparent_hash_ut.cpp2
-rw-r--r--util/generic/string_ut.cpp360
-rw-r--r--util/generic/string_ut.h104
-rw-r--r--util/generic/typelist_ut.cpp2
-rw-r--r--util/generic/typetraits.h2
-rw-r--r--util/generic/typetraits_ut.cpp2
-rw-r--r--util/generic/utility_ut.cpp2
-rw-r--r--util/generic/va_args_ut.cpp2
-rw-r--r--util/generic/vector.h28
-rw-r--r--util/generic/vector_ut.cpp22
-rw-r--r--util/generic/xrange.h110
-rw-r--r--util/generic/xrange_ut.cpp44
-rw-r--r--util/generic/yexception_ut.cpp2
-rw-r--r--util/generic/ylimits_ut.cpp2
-rw-r--r--util/generic/ymath_ut.cpp2
70 files changed, 462 insertions, 462 deletions
diff --git a/util/generic/adaptor_ut.cpp b/util/generic/adaptor_ut.cpp
index 721f849f93..c36d035843 100644
--- a/util/generic/adaptor_ut.cpp
+++ b/util/generic/adaptor_ut.cpp
@@ -1,7 +1,7 @@
#include "adaptor.h"
#include "yexception.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
struct TOnCopy: yexception {
};
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index 8d732fcc0c..dd9629da4d 100644
--- a/util/generic/algorithm_ut.cpp
+++ b/util/generic/algorithm_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "algorithm.h"
#include "strbuf.h"
diff --git a/util/generic/array_ref_ut.cpp b/util/generic/array_ref_ut.cpp
index 4c8eaf7135..d1bc763c51 100644
--- a/util/generic/array_ref_ut.cpp
+++ b/util/generic/array_ref_ut.cpp
@@ -1,6 +1,6 @@
#include "array_ref.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestArrayRef) {
Y_UNIT_TEST(TestDefaultConstructor) {
diff --git a/util/generic/array_size_ut.cpp b/util/generic/array_size_ut.cpp
index 13f45903c5..369c23658b 100644
--- a/util/generic/array_size_ut.cpp
+++ b/util/generic/array_size_ut.cpp
@@ -1,6 +1,6 @@
#include "array_size.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ArraySizeTest) {
Y_UNIT_TEST(Test1) {
diff --git a/util/generic/benchmark/fastclp2/main.cpp b/util/generic/benchmark/fastclp2/main.cpp
index 49277db077..f4095b0c57 100644
--- a/util/generic/benchmark/fastclp2/main.cpp
+++ b/util/generic/benchmark/fastclp2/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/bitops.h>
#include <util/generic/vector.h>
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
index 969f09a309..32b83e9538 100644
--- a/util/generic/benchmark/log2/main.cpp
+++ b/util/generic/benchmark/log2/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <library/cpp/fast_log/fast_log.h>
diff --git a/util/generic/benchmark/rotate_bits/main.cpp b/util/generic/benchmark/rotate_bits/main.cpp
index 057edbe864..838c8cf869 100644
--- a/util/generic/benchmark/rotate_bits/main.cpp
+++ b/util/generic/benchmark/rotate_bits/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/vector.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/singleton/main.cpp b/util/generic/benchmark/singleton/main.cpp
index 2b06bd371d..3a2a759370 100644
--- a/util/generic/benchmark/singleton/main.cpp
+++ b/util/generic/benchmark/singleton/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/singleton.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/smart_pointers/main.cpp b/util/generic/benchmark/smart_pointers/main.cpp
index 92c2f923bb..1d04c00bf6 100644
--- a/util/generic/benchmark/smart_pointers/main.cpp
+++ b/util/generic/benchmark/smart_pointers/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/ptr.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/sort/main.cpp b/util/generic/benchmark/sort/main.cpp
index d58f491f4d..7f3b5a9b26 100644
--- a/util/generic/benchmark/sort/main.cpp
+++ b/util/generic/benchmark/sort/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/benchmark/vector_count_ctor/f.cpp b/util/generic/benchmark/vector_count_ctor/f.cpp
index b89e351ba7..19ddc48781 100644
--- a/util/generic/benchmark/vector_count_ctor/f.cpp
+++ b/util/generic/benchmark/vector_count_ctor/f.cpp
@@ -1,6 +1,6 @@
#include "f.h"
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/vector.h>
#include <util/generic/ptr.h>
diff --git a/util/generic/benchmark/vector_count_ctor/main.cpp b/util/generic/benchmark/vector_count_ctor/main.cpp
index 6fb1fda9c9..78ac40ffc3 100644
--- a/util/generic/benchmark/vector_count_ctor/main.cpp
+++ b/util/generic/benchmark/vector_count_ctor/main.cpp
@@ -1,6 +1,6 @@
#include "f.h"
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#define DEFINE_BENCHMARK(N) \
Y_CPU_BENCHMARK(Yvector_##N, iface) { \
diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp
index 087d34a8dc..4e90309c74 100644
--- a/util/generic/bitmap_ut.cpp
+++ b/util/generic/bitmap_ut.cpp
@@ -1,6 +1,6 @@
#include "bitmap.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#define INIT_BITMAP(bitmap, bits) \
for (size_t i = 0; i < sizeof(bits) / sizeof(size_t); ++i) { \
diff --git a/util/generic/bitops.h b/util/generic/bitops.h
index 2db15fc59b..0de23f0be9 100644
--- a/util/generic/bitops.h
+++ b/util/generic/bitops.h
@@ -430,8 +430,8 @@ constexpr T RotateBitsRightCT(T value, const ui8 shift) noexcept {
*/
template <size_t Offset, size_t Size, class T>
Y_FORCE_INLINE T SelectBits(T value) {
- static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
- static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
+ static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
+ static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
T id = 1;
return (value >> Offset) & ((id << Size) - id);
}
@@ -441,8 +441,8 @@ Y_FORCE_INLINE T SelectBits(T value) {
*/
template <size_t Offset, size_t Size, class T>
void SetBits(T& value, T bits) {
- static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
- static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
+ static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
+ static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
T id = 1;
T maxValue = ((id << Size) - id);
Y_ASSERT(bits <= maxValue);
diff --git a/util/generic/bitops_ut.cpp b/util/generic/bitops_ut.cpp
index d23c2b5c27..a2a4539300 100644
--- a/util/generic/bitops_ut.cpp
+++ b/util/generic/bitops_ut.cpp
@@ -1,6 +1,6 @@
#include "bitops.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index b92697e1d0..71931aa467 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -4,7 +4,7 @@
#include "ymath.h"
#include <util/system/sys_alloc.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
TBuffer::TBuffer(size_t len)
: Data_(nullptr)
@@ -44,20 +44,20 @@ TBuffer& TBuffer::operator=(TBuffer&& b) noexcept {
return *this;
}
-void TBuffer::Append(const char* buf, size_t len) {
- if (len > Avail()) {
- Reserve(Pos_ + len);
- }
-
- Y_ASSERT(len <= Avail());
-
+void TBuffer::Append(const char* buf, size_t len) {
+ if (len > Avail()) {
+ Reserve(Pos_ + len);
+ }
+
+ Y_ASSERT(len <= Avail());
+
MemCopy(Data() + Pos_, buf, len);
- NSan::Unpoison(Data() + Pos_, len);
- Pos_ += len;
-
- Y_ASSERT(Pos_ <= Len_);
-}
-
+ NSan::Unpoison(Data() + Pos_, len);
+ Pos_ += len;
+
+ Y_ASSERT(Pos_ <= Len_);
+}
+
void TBuffer::Fill(char ch, size_t len) {
if (len > Avail()) {
Reserve(Pos_ + len);
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 9576467404..8bc3d9e8fe 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -92,7 +92,7 @@ public:
return Len_ - Pos_;
}
- void Append(const char* buf, size_t len);
+ void Append(const char* buf, size_t len);
inline void Append(const char* b, const char* e) {
Append(b, e - b);
diff --git a/util/generic/buffer_ut.cpp b/util/generic/buffer_ut.cpp
index 437d7122ec..b824798641 100644
--- a/util/generic/buffer_ut.cpp
+++ b/util/generic/buffer_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/datetime.h>
#include "string.h"
diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp
index 718a8de79d..7b51fb3ced 100644
--- a/util/generic/cast_ut.cpp
+++ b/util/generic/cast_ut.cpp
@@ -1,6 +1,6 @@
#include "cast.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TGenericCastsTest: public TTestBase {
UNIT_TEST_SUITE(TGenericCastsTest);
diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp
index 93bf50fa92..80adaef4b9 100644
--- a/util/generic/deque_ut.cpp
+++ b/util/generic/deque_ut.cpp
@@ -1,6 +1,6 @@
#include "deque.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include "yexception.h"
diff --git a/util/generic/explicit_type_ut.cpp b/util/generic/explicit_type_ut.cpp
index 50a745f090..09e839b77e 100644
--- a/util/generic/explicit_type_ut.cpp
+++ b/util/generic/explicit_type_ut.cpp
@@ -1,6 +1,6 @@
#include "explicit_type.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
struct TCallableBase {
public:
diff --git a/util/generic/flags_ut.cpp b/util/generic/flags_ut.cpp
index 5377c6a058..1ca01e4006 100644
--- a/util/generic/flags_ut.cpp
+++ b/util/generic/flags_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "flags.h"
diff --git a/util/generic/function_ut.cpp b/util/generic/function_ut.cpp
index 3880295a9f..8c754ec9db 100644
--- a/util/generic/function_ut.cpp
+++ b/util/generic/function_ut.cpp
@@ -1,7 +1,7 @@
#include "function.h"
#include "typetraits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestFunctionSignature) {
int FF(double x) {
diff --git a/util/generic/guid_ut.cpp b/util/generic/guid_ut.cpp
index 048354ff39..607ab75adc 100644
--- a/util/generic/guid_ut.cpp
+++ b/util/generic/guid_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "guid.h"
diff --git a/util/generic/hash.h b/util/generic/hash.h
index e46db21fa9..d9312fb860 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -621,7 +621,7 @@ public:
size_type max_size() const noexcept {
return size_type(-1);
}
-
+
Y_PURE_FUNCTION bool empty() const noexcept {
return size() == 0;
}
@@ -1530,7 +1530,7 @@ public:
size_type max_size() const noexcept {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const noexcept {
return rep.empty();
}
@@ -1855,7 +1855,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
diff --git a/util/generic/hash_primes_ut.cpp b/util/generic/hash_primes_ut.cpp
index 7b5bf8b5c9..3cde6e69a0 100644
--- a/util/generic/hash_primes_ut.cpp
+++ b/util/generic/hash_primes_ut.cpp
@@ -1,6 +1,6 @@
#include "hash_primes.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/vector.h>
#include <util/string/builder.h>
diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h
index e8088cf23b..8df4e0db79 100644
--- a/util/generic/hash_set.h
+++ b/util/generic/hash_set.h
@@ -122,7 +122,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
@@ -371,7 +371,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp
index 0551d58770..ee66b668d7 100644
--- a/util/generic/hash_ut.cpp
+++ b/util/generic/hash_ut.cpp
@@ -3,7 +3,7 @@
#include "hash_set.h"
#include <library/cpp/testing/common/probe.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include <util/str_stl.h>
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index eff7cdf2ee..a2c42448db 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -1,6 +1,6 @@
#include "intrlist.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp
index c668bce807..9e8a82d6fa 100644
--- a/util/generic/is_in_ut.cpp
+++ b/util/generic/is_in_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "algorithm.h"
#include "hash.h"
diff --git a/util/generic/iterator_range_ut.cpp b/util/generic/iterator_range_ut.cpp
index a7e3670ae1..ebd6633e33 100644
--- a/util/generic/iterator_range_ut.cpp
+++ b/util/generic/iterator_range_ut.cpp
@@ -1,6 +1,6 @@
#include "iterator_range.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/iterator_ut.cpp b/util/generic/iterator_ut.cpp
index 00be19e10e..96ecb8f899 100644
--- a/util/generic/iterator_ut.cpp
+++ b/util/generic/iterator_ut.cpp
@@ -1,6 +1,6 @@
#include "iterator.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TIterator) {
Y_UNIT_TEST(ToForwardIteratorTest) {
diff --git a/util/generic/lazy_value_ut.cpp b/util/generic/lazy_value_ut.cpp
index f6135880c3..033b68c8ef 100644
--- a/util/generic/lazy_value_ut.cpp
+++ b/util/generic/lazy_value_ut.cpp
@@ -1,6 +1,6 @@
#include "lazy_value.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TLazyValueTestSuite) {
Y_UNIT_TEST(TestLazyValue) {
diff --git a/util/generic/list_ut.cpp b/util/generic/list_ut.cpp
index 9e60ecf01b..2542358dfa 100644
--- a/util/generic/list_ut.cpp
+++ b/util/generic/list_ut.cpp
@@ -1,6 +1,6 @@
#include "list.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TYListSuite) {
Y_UNIT_TEST(TestInitializerList) {
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index 79e832b024..d13bc3ae84 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -1,6 +1,6 @@
#include "map.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/memory/pool.h>
#include <algorithm>
diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp
index 613da7a96b..74f8ad6b67 100644
--- a/util/generic/mapfindptr_ut.cpp
+++ b/util/generic/mapfindptr_ut.cpp
@@ -1,7 +1,7 @@
#include "string.h"
#include "hash.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <map>
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp
index 2c1a425c5e..f63b6362dc 100644
--- a/util/generic/maybe_ut.cpp
+++ b/util/generic/maybe_ut.cpp
@@ -1,7 +1,7 @@
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/stream/str.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "maybe.h"
@@ -150,11 +150,11 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
UNIT_ASSERT(m == 1);
- auto& x = m.ConstructInPlace(2);
+ auto& x = m.ConstructInPlace(2);
UNIT_ASSERT(m == 2);
- x = 7;
- UNIT_ASSERT(m == 7);
+ x = 7;
+ UNIT_ASSERT(m == 7);
}
Y_UNIT_TEST(TestMove) {
diff --git a/util/generic/mem_copy_ut.cpp b/util/generic/mem_copy_ut.cpp
index 8b55a11cf6..114181d27a 100644
--- a/util/generic/mem_copy_ut.cpp
+++ b/util/generic/mem_copy_ut.cpp
@@ -1,6 +1,6 @@
#include "mem_copy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
namespace {
class TAssignBCalled: public yexception {
diff --git a/util/generic/objects_counter_ut.cpp b/util/generic/objects_counter_ut.cpp
index 4d5da37a56..0578decc62 100644
--- a/util/generic/objects_counter_ut.cpp
+++ b/util/generic/objects_counter_ut.cpp
@@ -1,6 +1,6 @@
#include "object_counter.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ObjectsCounter) {
struct TObject: public TObjectCounter<TObject> {
diff --git a/util/generic/overloaded_ut.cpp b/util/generic/overloaded_ut.cpp
index f3d73895ad..68ddba94cf 100644
--- a/util/generic/overloaded_ut.cpp
+++ b/util/generic/overloaded_ut.cpp
@@ -1,6 +1,6 @@
#include <util/generic/overloaded.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/variant.h>
#include <util/generic/algorithm.h>
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 19db0e3ec5..8a4fcc3da9 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -185,7 +185,7 @@ public:
return *this;
}
- inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
return this->DoRelease(T_);
}
@@ -280,7 +280,7 @@ public:
Reset(nullptr);
}
- inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
return this->DoRelease(T_);
}
@@ -566,7 +566,7 @@ public:
TIntrusivePtr(nullptr).Swap(*this);
}
- inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
T* res = T_;
if (T_) {
Ops::DecRef(T_);
@@ -1011,7 +1011,7 @@ public:
return *this;
}
- inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
return DoRelease(T_);
}
diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp
index c2dcff23f6..306646d12d 100644
--- a/util/generic/ptr_ut.cpp
+++ b/util/generic/ptr_ut.cpp
@@ -2,7 +2,7 @@
#include "vector.h"
#include "noncopyable.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/hash_set.h>
#include <util/generic/is_in.h>
diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp
index a33399e104..7bee07699d 100644
--- a/util/generic/queue_ut.cpp
+++ b/util/generic/queue_ut.cpp
@@ -2,7 +2,7 @@
#include "list.h"
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
diff --git a/util/generic/reserve.h b/util/generic/reserve.h
index 81ceed19dc..72fb466018 100644
--- a/util/generic/reserve.h
+++ b/util/generic/reserve.h
@@ -1,11 +1,11 @@
-#pragma once
-
-namespace NDetail {
- struct TReserveTag {
- size_t Capacity;
- };
-}
-
+#pragma once
+
+namespace NDetail {
+ struct TReserveTag {
+ size_t Capacity;
+ };
+}
+
constexpr ::NDetail::TReserveTag Reserve(size_t capacity) {
return ::NDetail::TReserveTag{capacity};
-}
+}
diff --git a/util/generic/scope_ut.cpp b/util/generic/scope_ut.cpp
index bdb434d487..d1742ab444 100644
--- a/util/generic/scope_ut.cpp
+++ b/util/generic/scope_ut.cpp
@@ -1,7 +1,7 @@
#include "scope.h"
#include <util/generic/ptr.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ScopeToolsTest) {
Y_UNIT_TEST(OnScopeExitTest) {
diff --git a/util/generic/serialized_enum_ut.cpp b/util/generic/serialized_enum_ut.cpp
index 3a94e1d471..ab85b65961 100644
--- a/util/generic/serialized_enum_ut.cpp
+++ b/util/generic/serialized_enum_ut.cpp
@@ -1,6 +1,6 @@
#include "serialized_enum.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/deque.h>
#include <util/generic/map.h>
diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp
index d2769d327f..e11453c8e8 100644
--- a/util/generic/set_ut.cpp
+++ b/util/generic/set_ut.cpp
@@ -1,6 +1,6 @@
#include "set.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
diff --git a/util/generic/singleton.cpp b/util/generic/singleton.cpp
index eb5a0662f8..687b2b3f64 100644
--- a/util/generic/singleton.cpp
+++ b/util/generic/singleton.cpp
@@ -2,7 +2,7 @@
#include <util/system/spinlock.h>
#include <util/system/thread.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include <cstring>
@@ -32,12 +32,12 @@ void NPrivate::FillWithTrash(void* ptr, size_t len) {
Y_UNUSED(ptr);
Y_UNUSED(len);
#else
- if constexpr (NSan::TSanIsOn()) {
- Y_UNUSED(ptr);
- Y_UNUSED(len);
- } else {
- memset(ptr, 0xBA, len);
- }
+ if constexpr (NSan::TSanIsOn()) {
+ Y_UNUSED(ptr);
+ Y_UNUSED(len);
+ } else {
+ memset(ptr, 0xBA, len);
+ }
#endif
}
diff --git a/util/generic/singleton_ut.cpp b/util/generic/singleton_ut.cpp
index 35ba90cd76..2d50855677 100644
--- a/util/generic/singleton_ut.cpp
+++ b/util/generic/singleton_ut.cpp
@@ -1,6 +1,6 @@
#include "singleton.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestSingleton) {
struct THuge {
diff --git a/util/generic/stack_ut.cpp b/util/generic/stack_ut.cpp
index 248127d326..1c9dd7ed89 100644
--- a/util/generic/stack_ut.cpp
+++ b/util/generic/stack_ut.cpp
@@ -1,6 +1,6 @@
#include "stack.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TYStackTest) {
Y_UNIT_TEST(ExplicitBool) {
diff --git a/util/generic/store_policy_ut.cpp b/util/generic/store_policy_ut.cpp
index c9722203aa..c867a853f5 100644
--- a/util/generic/store_policy_ut.cpp
+++ b/util/generic/store_policy_ut.cpp
@@ -1,6 +1,6 @@
#include "store_policy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..e8bc89569a 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -483,14 +483,14 @@ public:
return !s.length() || find(s, pos) != npos;
}
- inline bool Contains(TChar c, size_t pos = 0) const noexcept {
+ inline bool Contains(TChar c, size_t pos = 0) const noexcept {
return find(c, pos) != npos;
}
- inline void Contains(std::enable_if<std::is_unsigned<TCharType>::value, char> c, size_t pos = 0) const noexcept {
- return find(ui8(c), pos) != npos;
- }
-
+ inline void Contains(std::enable_if<std::is_unsigned<TCharType>::value, char> c, size_t pos = 0) const noexcept {
+ return find(ui8(c), pos) != npos;
+ }
+
//~~~~Character Set Search~~~
inline size_t find_first_of(TCharType c) const noexcept {
return find_first_of(c, 0);
@@ -569,12 +569,12 @@ public:
return n;
}
- inline TDerived copy() const Y_WARN_UNUSED_RESULT {
+ inline TDerived copy() const Y_WARN_UNUSED_RESULT {
return TDerived(Ptr(), Len());
}
// ~~~ Partial copy ~~~~
- TDerived substr(size_t pos, size_t n = npos) const Y_WARN_UNUSED_RESULT {
+ TDerived substr(size_t pos, size_t n = npos) const Y_WARN_UNUSED_RESULT {
return TDerived(*This(), pos, n);
}
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index 69cde785af..20c284d352 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -1,6 +1,6 @@
#include "strbuf.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <string_view>
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 3c655f1f66..6242c45685 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -80,7 +80,7 @@ template <>
bool TBasicString<wchar16, std::char_traits<wchar16>>::to_title(size_t pos, size_t n) {
return ToTitle(*this, pos, n);
}
-
+
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendAscii(const ::TStringBuf& s) {
@@ -112,9 +112,9 @@ TBasicString<char, std::char_traits<char>>::AppendUtf16(const ::TWtringBuf& s) {
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf& s) {
- size_t oldSize = size();
+ size_t oldSize = size();
ReserveAndResize(size() + s.size() * 4);
- size_t written = 0;
+ size_t written = 0;
size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
if (pos != s.size()) {
ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
@@ -122,35 +122,35 @@ TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf&
resize(oldSize + written);
return *this;
-}
-
+}
+
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf16(const ::TWtringBuf& s) {
- size_t oldSize = size();
+ size_t oldSize = size();
ReserveAndResize(size() + s.size() * 2);
-
- wchar32* oldEnd = begin() + oldSize;
- wchar32* end = oldEnd;
+
+ wchar32* oldEnd = begin() + oldSize;
+ wchar32* end = oldEnd;
NDetail::UTF16ToUTF32ImplScalar(s.data(), s.data() + s.size(), end);
- size_t written = end - oldEnd;
-
+ size_t written = end - oldEnd;
+
resize(oldSize + written);
-
+
return *this;
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_lower(size_t pos, size_t n) {
return ToLower(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_upper(size_t pos, size_t n) {
return ToUpper(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_title(size_t pos, size_t n) {
return ToTitle(*this, pos, n);
-}
+}
diff --git a/util/generic/string.h b/util/generic/string.h
index 8cd8aa6917..543c494eda 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -14,7 +14,7 @@
#include "utility.h"
#include "bitops.h"
#include "explicit_type.h"
-#include "reserve.h"
+#include "reserve.h"
#include "singleton.h"
#include "strbase.h"
#include "strbuf.h"
@@ -379,7 +379,7 @@ public:
{
}
- inline explicit TBasicString(::NDetail::TReserveTag rt)
+ inline explicit TBasicString(::NDetail::TReserveTag rt)
#ifndef TSTRING_IS_STD_STRING
: S_(Construct())
#endif
diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp
index b87fa2843e..cf1170c3ac 100644
--- a/util/generic/string_transparent_hash_ut.cpp
+++ b/util/generic/string_transparent_hash_ut.cpp
@@ -2,7 +2,7 @@
#include "vector.h"
#include "strbuf.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
#include <util/str_stl.h>
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp
index ac82e9091d..93b9be3387 100644
--- a/util/generic/string_ut.cpp
+++ b/util/generic/string_ut.cpp
@@ -908,191 +908,191 @@ private:
UNIT_TEST_SUITE_REGISTRATION(TWideStringTest);
class TUtf32StringTest: public TTestBase, private TStringTestImpl<TUtf32String, TTestData<wchar32>> {
-public:
- UNIT_TEST_SUITE(TUtf32StringTest);
- UNIT_TEST(TestConstructors);
- UNIT_TEST(TestReplace);
+public:
+ UNIT_TEST_SUITE(TUtf32StringTest);
+ UNIT_TEST(TestConstructors);
+ UNIT_TEST(TestReplace);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestRefCount);
+ UNIT_TEST(TestRefCount);
#endif
- UNIT_TEST(TestFind);
- UNIT_TEST(TestContains);
- UNIT_TEST(TestOperators);
- UNIT_TEST(TestLetOperator)
- UNIT_TEST(TestMulOperators);
- UNIT_TEST(TestFuncs);
- UNIT_TEST(TestUtils);
- UNIT_TEST(TestEmpty);
- UNIT_TEST(TestJoin);
- UNIT_TEST(TestCopy);
- UNIT_TEST(TestStrCpy);
- UNIT_TEST(TestPrefixSuffix);
+ UNIT_TEST(TestFind);
+ UNIT_TEST(TestContains);
+ UNIT_TEST(TestOperators);
+ UNIT_TEST(TestLetOperator)
+ UNIT_TEST(TestMulOperators);
+ UNIT_TEST(TestFuncs);
+ UNIT_TEST(TestUtils);
+ UNIT_TEST(TestEmpty);
+ UNIT_TEST(TestJoin);
+ UNIT_TEST(TestCopy);
+ UNIT_TEST(TestStrCpy);
+ UNIT_TEST(TestPrefixSuffix);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestCharRef);
+ UNIT_TEST(TestCharRef);
#endif
- UNIT_TEST(TestBack);
- UNIT_TEST(TestFront)
- UNIT_TEST(TestDecodingMethods);
- UNIT_TEST(TestDecodingMethodsMixedStr);
+ UNIT_TEST(TestBack);
+ UNIT_TEST(TestFront)
+ UNIT_TEST(TestDecodingMethods);
+ UNIT_TEST(TestDecodingMethodsMixedStr);
UNIT_TEST(TestIterators);
UNIT_TEST(TestReverseIterators);
UNIT_TEST(TestStringLiterals);
- UNIT_TEST_SUITE_END();
-
-private:
- void TestDecodingMethods() {
- UNIT_ASSERT(TUtf32String::FromAscii("").empty());
- UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
-
- const char* text = "123kx83abcd ej)#$%ddja&%J&";
- TUtf32String wtext = ASCIIToUTF32(text);
-
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
-
- TString strtext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
-
- TStringBuf strbuftext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
-
- UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
-
- const wchar32 wideCyrillicAlphabet[] = {
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
- 0x00};
-
- TUtf32String strWide(wideCyrillicAlphabet);
- TString strUtf8 = WideToUTF8(strWide);
-
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
-
- // assign
-
- TUtf32String s1;
- s1.AssignAscii("1234");
- UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
-
- s1.AssignUtf8(strUtf8);
- UNIT_ASSERT(s1 == strWide);
-
- s1.AssignAscii(text);
- UNIT_ASSERT(s1 == wtext);
-
- // append
-
- TUtf32String s2;
- TUtf32String testAppend = strWide;
- s2.AppendUtf8(strUtf8);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += ' ';
- s2.AppendAscii(" ");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += '_';
- s2.AppendUtf8("_");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendAscii(text);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendUtf8(text);
-
- UNIT_ASSERT(testAppend == s2);
- }
-
- void TestDecodingMethodsMixedStr() {
- UNIT_ASSERT(TUtf32String::FromAscii("").empty());
- UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
-
- const char* text = "123kx83abcd ej)#$%ddja&%J&";
- TUtf32String wtext = ASCIIToUTF32(text);
-
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
-
- TString strtext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
-
- TStringBuf strbuftext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
-
- UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
-
- const wchar32 cyrilicAndLatinWide[] = {
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
- wchar32('z'),
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
- wchar32('z'),
- 0x00};
-
- TUtf32String strWide(cyrilicAndLatinWide);
- TString strUtf8 = WideToUTF8(strWide);
-
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
- UNIT_ASSERT(strWide == UTF8ToUTF32<true>(strUtf8));
- UNIT_ASSERT(strWide == UTF8ToUTF32<false>(strUtf8));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
-
- // assign
-
- TUtf32String s1;
- s1.AssignAscii("1234");
- UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
-
- s1.AssignUtf8(strUtf8);
- UNIT_ASSERT(s1 == strWide);
-
- s1.AssignAscii(text);
- UNIT_ASSERT(s1 == wtext);
-
- // append
-
- TUtf32String s2;
- TUtf32String testAppend = strWide;
- s2.AppendUtf16(UTF8ToWide(strUtf8));
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += ' ';
- s2.AppendAscii(" ");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += '_';
- s2.AppendUtf8("_");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendAscii(text);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendUtf8(text);
-
- UNIT_ASSERT(testAppend == s2);
- }
-
- void TestLetOperator() {
- TUtf32String str;
-
+ UNIT_TEST_SUITE_END();
+
+private:
+ void TestDecodingMethods() {
+ UNIT_ASSERT(TUtf32String::FromAscii("").empty());
+ UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
+
+ const char* text = "123kx83abcd ej)#$%ddja&%J&";
+ TUtf32String wtext = ASCIIToUTF32(text);
+
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
+
+ TString strtext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
+
+ TStringBuf strbuftext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
+
+ UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
+
+ const wchar32 wideCyrillicAlphabet[] = {
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ 0x00};
+
+ TUtf32String strWide(wideCyrillicAlphabet);
+ TString strUtf8 = WideToUTF8(strWide);
+
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
+
+ // assign
+
+ TUtf32String s1;
+ s1.AssignAscii("1234");
+ UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
+
+ s1.AssignUtf8(strUtf8);
+ UNIT_ASSERT(s1 == strWide);
+
+ s1.AssignAscii(text);
+ UNIT_ASSERT(s1 == wtext);
+
+ // append
+
+ TUtf32String s2;
+ TUtf32String testAppend = strWide;
+ s2.AppendUtf8(strUtf8);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += ' ';
+ s2.AppendAscii(" ");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += '_';
+ s2.AppendUtf8("_");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendAscii(text);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendUtf8(text);
+
+ UNIT_ASSERT(testAppend == s2);
+ }
+
+ void TestDecodingMethodsMixedStr() {
+ UNIT_ASSERT(TUtf32String::FromAscii("").empty());
+ UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
+
+ const char* text = "123kx83abcd ej)#$%ddja&%J&";
+ TUtf32String wtext = ASCIIToUTF32(text);
+
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
+
+ TString strtext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
+
+ TStringBuf strbuftext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
+
+ UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
+
+ const wchar32 cyrilicAndLatinWide[] = {
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+ wchar32('z'),
+ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ wchar32('z'),
+ 0x00};
+
+ TUtf32String strWide(cyrilicAndLatinWide);
+ TString strUtf8 = WideToUTF8(strWide);
+
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
+ UNIT_ASSERT(strWide == UTF8ToUTF32<true>(strUtf8));
+ UNIT_ASSERT(strWide == UTF8ToUTF32<false>(strUtf8));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
+
+ // assign
+
+ TUtf32String s1;
+ s1.AssignAscii("1234");
+ UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
+
+ s1.AssignUtf8(strUtf8);
+ UNIT_ASSERT(s1 == strWide);
+
+ s1.AssignAscii(text);
+ UNIT_ASSERT(s1 == wtext);
+
+ // append
+
+ TUtf32String s2;
+ TUtf32String testAppend = strWide;
+ s2.AppendUtf16(UTF8ToWide(strUtf8));
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += ' ';
+ s2.AppendAscii(" ");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += '_';
+ s2.AppendUtf8("_");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendAscii(text);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendUtf8(text);
+
+ UNIT_ASSERT(testAppend == s2);
+ }
+
+ void TestLetOperator() {
+ TUtf32String str;
+
str = wchar32('X');
- UNIT_ASSERT(str == TUtf32String::FromAscii("X"));
-
- const TUtf32String hello = TUtf32String::FromAscii("hello");
+ UNIT_ASSERT(str == TUtf32String::FromAscii("X"));
+
+ const TUtf32String hello = TUtf32String::FromAscii("hello");
str = hello.data();
- UNIT_ASSERT(str == hello);
-
- str = hello;
- UNIT_ASSERT(str == hello);
- }
+ UNIT_ASSERT(str == hello);
+
+ str = hello;
+ UNIT_ASSERT(str == hello);
+ }
void TestStringLiterals() {
TUtf32String s1 = U"hello";
@@ -1101,10 +1101,10 @@ private:
TUtf32String s2 = U"привет";
UNIT_ASSERT_VALUES_EQUAL(s2, TUtf32String::FromUtf8("привет"));
}
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest);
-
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest);
+
class TStringStdTest: public TTestBase, private TStringStdTestImpl<TString, TTestData<char>> {
public:
UNIT_TEST_SUITE(TStringStdTest);
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index 44bb10bdeb..55cd378e01 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -2,7 +2,7 @@
#include "string.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/reverse.h>
@@ -565,9 +565,9 @@ public:
TStringType s9(*Data._1());
UNIT_ASSERT(s9 == Data._1());
-
+
TStringType s10(Reserve(100));
- UNIT_ASSERT(s10.empty());
+ UNIT_ASSERT(s10.empty());
UNIT_ASSERT(s10.capacity() >= 100);
}
@@ -1011,14 +1011,14 @@ public:
UNIT_ASSERT(!s1.IsDetached());
/* Read access shouldn't detach. */
- UNIT_ASSERT_VALUES_EQUAL(s0[0], (ui8)'a');
+ UNIT_ASSERT_VALUES_EQUAL(s0[0], (ui8)'a');
UNIT_ASSERT(!s0.IsDetached());
UNIT_ASSERT(!s1.IsDetached());
/* Writing should detach. */
- s1[0] = (ui8)'b';
+ s1[0] = (ui8)'b';
TStringType s2 = s0;
- s0[0] = (ui8)'c';
+ s0[0] = (ui8)'c';
UNIT_ASSERT_VALUES_EQUAL(s0, cbc);
UNIT_ASSERT_VALUES_EQUAL(s1, bbc);
@@ -1028,9 +1028,9 @@ public:
UNIT_ASSERT(s2.IsDetached());
/* Accessing null terminator is OK. Note that writing into it is UB. */
- UNIT_ASSERT_VALUES_EQUAL(s0[3], (ui8)'\0');
- UNIT_ASSERT_VALUES_EQUAL(s1[3], (ui8)'\0');
- UNIT_ASSERT_VALUES_EQUAL(s2[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s0[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s1[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s2[3], (ui8)'\0');
/* Assignment one char reference to another results in modification of underlying character */
{
@@ -1053,12 +1053,12 @@ public:
TStringType str = chars;
const TStringType constStr = str;
- UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'o');
str.back() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'r');
}
void TestFront() {
@@ -1067,12 +1067,12 @@ public:
TStringType str = chars;
const TStringType constStr = str;
- UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'f');
str.front() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'r');
}
void TestIterators() {
@@ -1086,31 +1086,31 @@ public:
typename TStringType::const_iterator citBegin = constStr.begin();
typename TStringType::const_iterator citEnd = constStr.end();
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
str.front() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(2, itEnd - itBegin);
UNIT_ASSERT_VALUES_EQUAL(2, citEnd - citBegin);
- UNIT_ASSERT_VALUES_EQUAL(*(++itBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(++citBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(++itBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(++citBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(--itBegin), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(--citBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(--itBegin), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(--citBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(itBegin++), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(citBegin++), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(itBegin++), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(citBegin++), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(itBegin--), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(citBegin--), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(itBegin--), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(citBegin--), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
}
void TestReverseIterators() {
@@ -1124,33 +1124,33 @@ public:
typename TStringType::const_reverse_iterator critBegin = constStr.rbegin();
typename TStringType::const_reverse_iterator critEnd = constStr.rend();
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
- str.back() = (ui8)'r';
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ str.back() = (ui8)'r';
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(2, ritEnd - ritBegin);
UNIT_ASSERT_VALUES_EQUAL(2, critEnd - critBegin);
- UNIT_ASSERT_VALUES_EQUAL(*(++ritBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(++critBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(++ritBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(++critBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(--ritBegin), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(--critBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(--ritBegin), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(--critBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(ritBegin++), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(critBegin++), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(ritBegin++), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(critBegin++), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(ritBegin--), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(critBegin--), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(ritBegin--), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(critBegin--), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
- *ritBegin = (ui8)'e';
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'e');
+ *ritBegin = (ui8)'e';
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'e');
}
};
diff --git a/util/generic/typelist_ut.cpp b/util/generic/typelist_ut.cpp
index eeabfa97b1..6216d5e0a0 100644
--- a/util/generic/typelist_ut.cpp
+++ b/util/generic/typelist_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/type_name.h>
#include "typelist.h"
diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h
index d165bd1a06..e8ad545631 100644
--- a/util/generic/typetraits.h
+++ b/util/generic/typetraits.h
@@ -235,7 +235,7 @@ struct TPodTraits<std::pair<T1, T2>> {
};
};
-template <class T>
+template <class T>
struct TIsPointerToConstMemberFunction: std::false_type {
};
diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp
index e7571c75ec..afad5cc4d2 100644
--- a/util/generic/typetraits_ut.cpp
+++ b/util/generic/typetraits_ut.cpp
@@ -1,6 +1,6 @@
#include "typetraits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <vector>
#include <tuple>
diff --git a/util/generic/utility_ut.cpp b/util/generic/utility_ut.cpp
index 8e9d5afff9..3226322cc5 100644
--- a/util/generic/utility_ut.cpp
+++ b/util/generic/utility_ut.cpp
@@ -1,7 +1,7 @@
#include "utility.h"
#include "ymath.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
// DO_NOT_STYLE
diff --git a/util/generic/va_args_ut.cpp b/util/generic/va_args_ut.cpp
index a9c96a0f55..3ea47b43ea 100644
--- a/util/generic/va_args_ut.cpp
+++ b/util/generic/va_args_ut.cpp
@@ -1,6 +1,6 @@
#include "va_args.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
Y_UNIT_TEST(TestMapArgs) {
diff --git a/util/generic/vector.h b/util/generic/vector.h
index a5b258955a..935e9c0c59 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -1,7 +1,7 @@
#pragma once
#include "fwd.h"
-#include "reserve.h"
+#include "reserve.h"
#include <util/memory/alloc.h>
@@ -26,17 +26,17 @@ public:
}
inline explicit TVector(::NDetail::TReserveTag rt)
- : TBase()
- {
- this->reserve(rt.Capacity);
- }
-
+ : TBase()
+ {
+ this->reserve(rt.Capacity);
+ }
+
inline explicit TVector(::NDetail::TReserveTag rt, const typename TBase::allocator_type& a)
- : TBase(a)
- {
- this->reserve(rt.Capacity);
- }
-
+ : TBase(a)
+ {
+ this->reserve(rt.Capacity);
+ }
+
inline explicit TVector(size_type count)
: TBase(count)
{
@@ -103,9 +103,9 @@ public:
}
Y_PURE_FUNCTION inline bool empty() const noexcept {
- return TBase::empty();
- }
-
+ return TBase::empty();
+ }
+
inline yssize_t ysize() const noexcept {
return (yssize_t)TBase::size();
}
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp
index 0f6b4037a0..be3cd24828 100644
--- a/util/generic/vector_ut.cpp
+++ b/util/generic/vector_ut.cpp
@@ -1,6 +1,6 @@
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include "yexception.h"
@@ -279,13 +279,13 @@ private:
UNIT_ASSERT(v[5] == 25);
UNIT_ASSERT(v[6] == 36);
- size_t curCapacity = v.capacity();
+ size_t curCapacity = v.capacity();
v.clear();
UNIT_ASSERT(v.empty());
- //check that clear save reserved data
- UNIT_ASSERT_EQUAL(curCapacity, v.capacity());
-
+ //check that clear save reserved data
+ UNIT_ASSERT_EQUAL(curCapacity, v.capacity());
+
v.insert(v.begin(), 5, 10);
UNIT_ASSERT(v.size() == 5);
UNIT_ASSERT(v[0] == 10);
@@ -312,12 +312,12 @@ private:
{
TVector<int> v(Reserve(100));
-
- UNIT_ASSERT(v.capacity() >= 100);
- UNIT_ASSERT(v.size() == 0);
- }
-
- {
+
+ UNIT_ASSERT(v.capacity() >= 100);
+ UNIT_ASSERT(v.size() == 0);
+ }
+
+ {
//Test that used to generate an assertion when using __debug_alloc.
TVector<TestStruct> va;
va.reserve(1);
diff --git a/util/generic/xrange.h b/util/generic/xrange.h
index 5fc8c82912..578605f356 100644
--- a/util/generic/xrange.h
+++ b/util/generic/xrange.h
@@ -13,16 +13,16 @@
* for (auto i: xrange(MyVector.size())) { // instead for (size_t i = 0; i < MyVector.size(); ++i)
* DoSomething(i, MyVector[i]);
* }
- *
+ *
* TVector<int> arithmeticSeq = xrange(10); // instead: TVector<int> arithmeticSeq; for(size_t i = 0; i < 10; ++i) { arithmeticSeq.push_back(i); }
- *
+ *
*/
namespace NPrivate {
template <typename T>
class TSimpleXRange {
- using TDiff = decltype(T() - T());
-
+ using TDiff = decltype(T() - T());
+
public:
constexpr TSimpleXRange(T start, T finish) noexcept
: Start(start)
@@ -52,12 +52,12 @@ namespace NPrivate {
}
constexpr bool operator==(const TIterator& other) const noexcept {
- return Value == other.Value;
- }
-
- TIterator& operator++() noexcept {
+ return Value == other.Value;
+ }
+
+ TIterator& operator++() noexcept {
++Value;
- return *this;
+ return *this;
}
TIterator& operator--() noexcept {
@@ -66,25 +66,25 @@ namespace NPrivate {
}
constexpr TDiff operator-(const TIterator& b) const noexcept {
- return Value - b.Value;
- }
-
+ return Value - b.Value;
+ }
+
template <typename IntType>
constexpr TIterator operator+(const IntType& b) const noexcept {
- return TIterator(Value + b);
- }
-
+ return TIterator(Value + b);
+ }
+
template <typename IntType>
TIterator& operator+=(const IntType& b) noexcept {
- Value += b;
- return *this;
- }
-
+ Value += b;
+ return *this;
+ }
+
template <typename IntType>
constexpr TIterator operator-(const IntType& b) const noexcept {
- return TIterator(Value - b);
- }
-
+ return TIterator(Value - b);
+ }
+
template <typename IntType>
TIterator& operator-=(const IntType& b) noexcept {
Value -= b;
@@ -100,9 +100,9 @@ namespace NPrivate {
};
using value_type = T;
- using iterator = TIterator;
- using const_iterator = TIterator;
-
+ using iterator = TIterator;
+ using const_iterator = TIterator;
+
constexpr TIterator begin() const noexcept {
return TIterator(Start);
}
@@ -112,14 +112,14 @@ namespace NPrivate {
}
constexpr T size() const noexcept {
- return Finish - Start;
- }
-
- template <class Container>
+ return Finish - Start;
+ }
+
+ template <class Container>
operator Container() const {
- return Container(begin(), end());
- }
-
+ return Container(begin(), end());
+ }
+
private:
T Start;
T Finish;
@@ -161,12 +161,12 @@ namespace NPrivate {
}
constexpr bool operator==(const TIterator& other) const noexcept {
- return Value_ == other.Value_;
- }
-
- TIterator& operator++() noexcept {
+ return Value_ == other.Value_;
+ }
+
+ TIterator& operator++() noexcept {
Value_ += Parent_->Step_;
- return *this;
+ return *this;
}
TIterator& operator--() noexcept {
@@ -176,23 +176,23 @@ namespace NPrivate {
constexpr TDiff operator-(const TIterator& b) const noexcept {
return (Value_ - b.Value_) / Parent_->Step_;
- }
-
+ }
+
template <typename IntType>
constexpr TIterator operator+(const IntType& b) const noexcept {
return TIterator(*this) += b;
- }
-
+ }
+
template <typename IntType>
TIterator& operator+=(const IntType& b) noexcept {
Value_ += b * Parent_->Step_;
- return *this;
- }
-
+ return *this;
+ }
+
template <typename IntType>
constexpr TIterator operator-(const IntType& b) const noexcept {
return TIterator(*this) -= b;
- }
+ }
template <typename IntType>
TIterator& operator-=(const IntType& b) noexcept {
@@ -206,9 +206,9 @@ namespace NPrivate {
};
using value_type = T;
- using iterator = TIterator;
- using const_iterator = TIterator;
-
+ using iterator = TIterator;
+ using const_iterator = TIterator;
+
constexpr TIterator begin() const noexcept {
return TIterator(Start_, *this);
}
@@ -229,14 +229,14 @@ namespace NPrivate {
}
constexpr T size() const noexcept {
- return (Finish_ - Start_) / Step_;
- }
-
- template <class Container>
+ return (Finish_ - Start_) / Step_;
+ }
+
+ template <class Container>
operator Container() const {
- return Container(begin(), end());
- }
-
+ return Container(begin(), end());
+ }
+
private:
const T Start_;
const TDiff Step_;
diff --git a/util/generic/xrange_ut.cpp b/util/generic/xrange_ut.cpp
index 8106da03e7..f8ba3c6f1f 100644
--- a/util/generic/xrange_ut.cpp
+++ b/util/generic/xrange_ut.cpp
@@ -3,7 +3,7 @@
#include "algorithm.h"
#include "maybe.h"
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
Y_UNIT_TEST_SUITE(XRange) {
@@ -78,40 +78,40 @@ Y_UNIT_TEST_SUITE(XRange) {
}
UNIT_ASSERT_VALUES_EQUAL(digSumByPtr, digSumExpected);
}
-
+
Y_UNIT_TEST(SizeMethodCheck) {
- UNIT_ASSERT_VALUES_EQUAL(xrange(5).size(), 5);
- UNIT_ASSERT_VALUES_EQUAL(xrange(0, 5, 2).size(), 3);
- UNIT_ASSERT_VALUES_EQUAL(xrange(0, 6, 2).size(), 3);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(xrange(5).size(), 5);
+ UNIT_ASSERT_VALUES_EQUAL(xrange(0, 5, 2).size(), 3);
+ UNIT_ASSERT_VALUES_EQUAL(xrange(0, 6, 2).size(), 3);
+ }
+
class TVectorChild: public TVector<size_t> {
- public:
+ public:
template <typename TIterator>
TVectorChild(TIterator a, TIterator b)
: TVector<size_t>(a, b)
{
}
- };
-
+ };
+
Y_UNIT_TEST(ConvertionWorks) {
TVector<size_t> data = {0, 1, 2, 3, 4, 5, 6, 7, 8};
-
+
TVector<size_t> convertionResults[] = {xrange<size_t>(9),
xrange<ui32>(0, 9),
xrange(0, 9, 1)};
-
- for (const auto& arr : convertionResults) {
- UNIT_ASSERT(arr == data);
- }
-
- TVectorChild sons[] = {xrange(0, 9),
+
+ for (const auto& arr : convertionResults) {
+ UNIT_ASSERT(arr == data);
+ }
+
+ TVectorChild sons[] = {xrange(0, 9),
xrange(0, 9, 1)};
-
- for (const auto& arr : sons) {
- UNIT_ASSERT(arr == data);
- }
- }
+
+ for (const auto& arr : sons) {
+ UNIT_ASSERT(arr == data);
+ }
+ }
template <class XRangeContainer>
void TestEmptyRanges(const XRangeContainer& c) {
diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp
index cb3e29fed8..3b3a66eb73 100644
--- a/util/generic/yexception_ut.cpp
+++ b/util/generic/yexception_ut.cpp
@@ -8,7 +8,7 @@ static inline void Throw2DontMove() {
ythrow yexception() << 1 << " qw " << 12.1; // don't move this line
}
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/memory/tempbuf.h>
diff --git a/util/generic/ylimits_ut.cpp b/util/generic/ylimits_ut.cpp
index f1b3c6858c..a77fb0c74c 100644
--- a/util/generic/ylimits_ut.cpp
+++ b/util/generic/ylimits_ut.cpp
@@ -1,7 +1,7 @@
#include "cast.h"
#include "ylimits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/cast.h>
#include <util/system/valgrind.h>
diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp
index 29190b55eb..270ab5d1b1 100644
--- a/util/generic/ymath_ut.cpp
+++ b/util/generic/ymath_ut.cpp
@@ -1,7 +1,7 @@
#include "bitops.h"
#include "ymath.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
#include <util/datetime/cputimer.h>