aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorgotmanov <gotmanov@yandex-team.ru>2022-02-10 16:49:26 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:26 +0300
commit243edeedfd2c5152b5c7812e0af471e1bb0232e8 (patch)
tree7efbef4b4e045bcee8833f7fc22a639fa0ff06aa /util
parent56c39b3cf908e7202b1f7551a1653681e8015607 (diff)
downloadydb-243edeedfd2c5152b5c7812e0af471e1bb0232e8.tar.gz
Restoring authorship annotation for <gotmanov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/flags.h16
-rw-r--r--util/generic/flags_ut.cpp4
-rw-r--r--util/generic/map_ut.cpp26
-rw-r--r--util/generic/typelist.cpp6
-rw-r--r--util/memory/pool.h6
-rw-r--r--util/memory/pool_ut.cpp82
-rw-r--r--util/stream/input.cpp2
-rw-r--r--util/stream/input_ut.cpp76
8 files changed, 109 insertions, 109 deletions
diff --git a/util/generic/flags.h b/util/generic/flags.h
index a1f5921d42..ada083de7f 100644
--- a/util/generic/flags.h
+++ b/util/generic/flags.h
@@ -3,7 +3,7 @@
#include <type_traits>
#include <util/system/types.h>
-#include <util/generic/typetraits.h>
+#include <util/generic/typetraits.h>
#include <util/generic/fwd.h>
class IOutputStream;
@@ -203,13 +203,13 @@ private:
TInt Value_;
};
-template <class T>
-struct TPodTraits<TFlags<T>> {
- enum {
- IsPod = TTypeTraits<T>::IsPod
- };
-};
-
+template <class T>
+struct TPodTraits<TFlags<T>> {
+ enum {
+ IsPod = TTypeTraits<T>::IsPod
+ };
+};
+
template <class Enum>
struct THash<TFlags<Enum>> {
size_t operator()(const TFlags<Enum>& flags) const noexcept {
diff --git a/util/generic/flags_ut.cpp b/util/generic/flags_ut.cpp
index 5377c6a058..75a06173bb 100644
--- a/util/generic/flags_ut.cpp
+++ b/util/generic/flags_ut.cpp
@@ -11,8 +11,8 @@ enum ETestFlag1: ui16 {
Y_DECLARE_FLAGS(ETest1, ETestFlag1)
Y_DECLARE_OPERATORS_FOR_FLAGS(ETest1)
-static_assert(TTypeTraits<ETest1>::IsPod, "flags should be POD type");
-
+static_assert(TTypeTraits<ETest1>::IsPod, "flags should be POD type");
+
enum class ETestFlag2 {
Test1 = 1,
Test2 = 2,
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index 79e832b024..64a2ad6d04 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -476,21 +476,21 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
expected.emplace("three", 3);
UNIT_ASSERT_VALUES_EQUAL(mm, expected);
}
-
+
Y_UNIT_TEST(TestMovePoolAlloc) {
using TMapInPool = TMap<int, int, TLess<int>, TPoolAllocator>;
-
- TMemoryPool pool(1);
-
- TMapInPool m(&pool);
- m.emplace(0, 1);
-
+
+ TMemoryPool pool(1);
+
+ TMapInPool m(&pool);
+ m.emplace(0, 1);
+
UNIT_ASSERT(m.contains(0));
- UNIT_ASSERT_VALUES_EQUAL(1, m[0]);
-
- TMapInPool movedM = std::move(m);
-
+ UNIT_ASSERT_VALUES_EQUAL(1, m[0]);
+
+ TMapInPool movedM = std::move(m);
+
UNIT_ASSERT(movedM.contains(0));
- UNIT_ASSERT_VALUES_EQUAL(1, movedM[0]);
- }
+ UNIT_ASSERT_VALUES_EQUAL(1, movedM[0]);
+ }
}
diff --git a/util/generic/typelist.cpp b/util/generic/typelist.cpp
index 275b565ddb..df347aafec 100644
--- a/util/generic/typelist.cpp
+++ b/util/generic/typelist.cpp
@@ -1,5 +1,5 @@
#include "typelist.h"
-static_assert(
- TSignedInts::THave<char>::value,
- "char type in Arcadia must be signed; add -fsigned-char to compiler options");
+static_assert(
+ TSignedInts::THave<char>::value,
+ "char type in Arcadia must be signed; add -fsigned-char to compiler options");
diff --git a/util/memory/pool.h b/util/memory/pool.h
index 13c8b6b9ed..2e4e8da840 100644
--- a/util/memory/pool.h
+++ b/util/memory/pool.h
@@ -388,9 +388,9 @@ public:
return size_type(-1) / sizeof(T);
}
- template <typename... Args>
- inline void construct(pointer p, Args&&... args) {
- new (p) T(std::forward<Args>(args)...);
+ template <typename... Args>
+ inline void construct(pointer p, Args&&... args) {
+ new (p) T(std::forward<Args>(args)...);
}
inline void destroy(pointer p) noexcept {
diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp
index 1158a8ca42..5c6aa59feb 100644
--- a/util/memory/pool_ut.cpp
+++ b/util/memory/pool_ut.cpp
@@ -50,39 +50,39 @@ private:
size_t Frees_;
};
-class TErrorOnCopy {
-public:
- TErrorOnCopy() = default;
- TErrorOnCopy(TErrorOnCopy&&) = default;
-
- TErrorOnCopy(const TErrorOnCopy&) {
- UNIT_ASSERT(false);
- }
-};
-
-class TNoCopy {
-public:
- TNoCopy() = default;
- TNoCopy(TNoCopy&&) = default;
-
- TNoCopy(const TNoCopy&) = delete;
-};
-
-class TNoMove {
-public:
- TNoMove() = default;
- TNoMove(const TNoMove&) = default;
-
- TNoMove(TNoMove&&) = delete;
-};
-
+class TErrorOnCopy {
+public:
+ TErrorOnCopy() = default;
+ TErrorOnCopy(TErrorOnCopy&&) = default;
+
+ TErrorOnCopy(const TErrorOnCopy&) {
+ UNIT_ASSERT(false);
+ }
+};
+
+class TNoCopy {
+public:
+ TNoCopy() = default;
+ TNoCopy(TNoCopy&&) = default;
+
+ TNoCopy(const TNoCopy&) = delete;
+};
+
+class TNoMove {
+public:
+ TNoMove() = default;
+ TNoMove(const TNoMove&) = default;
+
+ TNoMove(TNoMove&&) = delete;
+};
+
class TMemPoolTest: public TTestBase {
UNIT_TEST_SUITE(TMemPoolTest);
UNIT_TEST(TestMemPool)
UNIT_TEST(TestAlign)
UNIT_TEST(TestZeroArray)
UNIT_TEST(TestLargeStartingAlign)
- UNIT_TEST(TestMoveAlloc)
+ UNIT_TEST(TestMoveAlloc)
UNIT_TEST(TestRoundUpToNextPowerOfTwoOption)
UNIT_TEST_SUITE_END();
@@ -223,22 +223,22 @@ private:
UNIT_ASSERT_VALUES_EQUAL(reinterpret_cast<uintptr_t>(aligned4k1) & 4095, 0);
UNIT_ASSERT_VALUES_EQUAL(reinterpret_cast<uintptr_t>(aligned4k2) & 4095, 0);
}
-
- template <typename T>
- void CheckMoveAlloc() {
- TMemoryPool pool(10 * sizeof(T));
-
+
+ template <typename T>
+ void CheckMoveAlloc() {
+ TMemoryPool pool(10 * sizeof(T));
+
TVector<T, TPoolAllocator> elems(&pool);
- elems.reserve(1);
- elems.emplace_back();
- elems.resize(100);
- }
-
- void TestMoveAlloc() {
- CheckMoveAlloc<TNoMove>();
- CheckMoveAlloc<TNoCopy>();
- CheckMoveAlloc<TErrorOnCopy>();
+ elems.reserve(1);
+ elems.emplace_back();
+ elems.resize(100);
}
+
+ void TestMoveAlloc() {
+ CheckMoveAlloc<TNoMove>();
+ CheckMoveAlloc<TNoCopy>();
+ CheckMoveAlloc<TErrorOnCopy>();
+ }
void TestRoundUpToNextPowerOfTwoOption() {
const size_t MEMORY_POOL_BLOCK_SIZE = (1024 - 16) * 4096 - 16 - 16 - 32;
diff --git a/util/stream/input.cpp b/util/stream/input.cpp
index 6e8170f2f9..7ef40c1510 100644
--- a/util/stream/input.cpp
+++ b/util/stream/input.cpp
@@ -209,7 +209,7 @@ namespace {
st.AssignNoAlias(B_, r);
- if (st && st.back() == ch) {
+ if (st && st.back() == ch) {
st.pop_back();
}
diff --git a/util/stream/input_ut.cpp b/util/stream/input_ut.cpp
index 4a93f5458e..3e22e1f3b9 100644
--- a/util/stream/input_ut.cpp
+++ b/util/stream/input_ut.cpp
@@ -3,44 +3,44 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/file.h>
+#include <util/system/file.h>
#include <util/system/yassert.h>
#ifdef _win_
#include <io.h>
#endif
-class TMockStdIn {
-public:
- TMockStdIn()
+class TMockStdIn {
+public:
+ TMockStdIn()
: StdInCopy_(dup(0))
{
}
- ~TMockStdIn() {
+ ~TMockStdIn() {
close(StdInCopy_);
- }
-
- template <typename FuncType>
+ }
+
+ template <typename FuncType>
void ForInput(const TStringBuf text, const FuncType& func) {
- TFile tempFile(TFile::Temporary("input_ut"));
+ TFile tempFile(TFile::Temporary("input_ut"));
tempFile.Write(text.data(), text.size());
- tempFile.FlushData();
- tempFile.Seek(0, sSet);
-
- TFileHandle tempFh(tempFile.GetHandle());
+ tempFile.FlushData();
+ tempFile.Seek(0, sSet);
+
+ TFileHandle tempFh(tempFile.GetHandle());
tempFh.Duplicate2Posix(0);
- tempFh.Release();
-
- func();
- Cin.ReadAll();
+ tempFh.Release();
+
+ func();
+ Cin.ReadAll();
dup2(StdInCopy_, 0);
clearerr(stdin);
- }
+ }
-private:
+private:
int StdInCopy_;
-};
-
+};
+
class TNoInput: public IInputStream {
public:
TNoInput(ui64 size)
@@ -130,28 +130,28 @@ Y_UNIT_TEST_SUITE(TInputTest) {
UNIT_ASSERT_VALUES_EQUAL(in.ReadLine(t), 0);
UNIT_ASSERT_VALUES_EQUAL(t, "333");
}
-
+
Y_UNIT_TEST(TestStdInReadTo) {
- std::pair<std::pair<TStringBuf, char>, TStringBuf> testPairs[] = {
- {{"", '\n'}, ""},
- {{"\n", '\n'}, ""},
- {{"\n\t", '\t'}, "\n"},
- {{"\t\n", '\n'}, "\t"},
+ std::pair<std::pair<TStringBuf, char>, TStringBuf> testPairs[] = {
+ {{"", '\n'}, ""},
+ {{"\n", '\n'}, ""},
+ {{"\n\t", '\t'}, "\n"},
+ {{"\t\n", '\n'}, "\t"},
{{"a\tb\n", '\t'}, "a"}};
-
- TMockStdIn stdIn;
-
- for (const auto& testPair : testPairs) {
- const TStringBuf text = testPair.first.first;
- const char delim = testPair.first.second;
- const TStringBuf expectedValue = testPair.second;
-
- stdIn.ForInput(text,
+
+ TMockStdIn stdIn;
+
+ for (const auto& testPair : testPairs) {
+ const TStringBuf text = testPair.first.first;
+ const char delim = testPair.first.second;
+ const TStringBuf expectedValue = testPair.second;
+
+ stdIn.ForInput(text,
[=] {
TString value;
Cin.ReadTo(value, delim);
UNIT_ASSERT_VALUES_EQUAL(value, expectedValue);
});
- }
- }
+ }
+ }
}