aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorartkolesnikov <artkolesnikov@yandex-team.ru>2022-02-10 16:47:36 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:36 +0300
commit8611780b719073fe6c7e6536c71d61e20d57a5d6 (patch)
tree1284229a15a8eeeb4e9c81a6473f4e31d625cb52 /util
parentcfadda92ca195da3ad68d721a58872a4f1ced696 (diff)
downloadydb-8611780b719073fe6c7e6536c71d61e20d57a5d6.tar.gz
Restoring authorship annotation for <artkolesnikov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/buffer.cpp26
-rw-r--r--util/generic/buffer.h2
-rw-r--r--util/generic/refcount.h46
-rw-r--r--util/generic/typetraits_ut.cpp78
-rw-r--r--util/stream/str_ut.cpp46
5 files changed, 99 insertions, 99 deletions
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index b92697e1d0..ef2b4b740a 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -31,19 +31,19 @@ TBuffer::TBuffer(const char* buf, size_t len)
}
TBuffer& TBuffer::operator=(TBuffer&& b) noexcept {
- y_deallocate(Data_);
-
- Data_ = b.Data_;
- Len_ = b.Len_;
- Pos_ = b.Pos_;
-
- b.Data_ = nullptr;
- b.Len_ = 0;
- b.Pos_ = 0;
-
- return *this;
-}
-
+ y_deallocate(Data_);
+
+ Data_ = b.Data_;
+ Len_ = b.Len_;
+ Pos_ = b.Pos_;
+
+ b.Data_ = nullptr;
+ b.Len_ = 0;
+ b.Pos_ = 0;
+
+ return *this;
+}
+
void TBuffer::Append(const char* buf, size_t len) {
if (len > Avail()) {
Reserve(Pos_ + len);
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 9576467404..80fd289b17 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -27,7 +27,7 @@ public:
TBuffer(TBuffer&& b) noexcept;
TBuffer& operator=(TBuffer&& b) noexcept;
-
+
TBuffer& operator=(const TBuffer& b) {
if (this != &b) {
Assign(b.Data(), b.Size());
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 966e853b77..531db87022 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -38,16 +38,16 @@ public:
}
inline bool TryWeakInc() noexcept {
- if (!Counter_) {
- return false;
- }
-
- Inc();
+ if (!Counter_) {
+ return false;
+ }
+
+ Inc();
Y_ASSERT(Counter_ != 0);
- return true;
- }
-
+ return true;
+ }
+
inline TAtomicBase Val() const noexcept {
return Counter_;
}
@@ -130,22 +130,22 @@ public:
}
inline bool TryWeakInc() noexcept {
- while (true) {
- intptr_t curValue = Counter_;
-
- if (!curValue) {
- return false;
- }
-
- intptr_t newValue = curValue + 1;
+ while (true) {
+ intptr_t curValue = Counter_;
+
+ if (!curValue) {
+ return false;
+ }
+
+ intptr_t newValue = curValue + 1;
Y_ASSERT(newValue != 0);
-
- if (AtomicCas(&Counter_, newValue, curValue)) {
- return true;
- }
- }
- }
-
+
+ if (AtomicCas(&Counter_, newValue, curValue)) {
+ return true;
+ }
+ }
+ }
+
private:
TAtomic Counter_;
};
diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp
index e7571c75ec..84169f1267 100644
--- a/util/generic/typetraits_ut.cpp
+++ b/util/generic/typetraits_ut.cpp
@@ -9,11 +9,11 @@ namespace {
enum ETestEnum {
};
- class TPodClass {
+ class TPodClass {
};
- class TNonPodClass {
- TNonPodClass() {
+ class TNonPodClass {
+ TNonPodClass() {
}
};
@@ -39,37 +39,37 @@ namespace {
class TNonEmptyDerivedClass: public TNonEmptyClass {
};
-
+
class TStdLayoutClass1: public TEmptyClass {
- public:
- int Value1;
- int Value2;
- };
-
+ public:
+ int Value1;
+ int Value2;
+ };
+
class TStdLayoutClass2: public TNonEmptyClass {
- };
-
- class TNonStdLayoutClass1 {
- public:
- int Value1;
+ };
+
+ class TNonStdLayoutClass1 {
+ public:
+ int Value1;
protected:
- int Value2;
- };
-
- class TNonStdLayoutClass2 {
- public:
+ int Value2;
+ };
+
+ class TNonStdLayoutClass2 {
+ public:
virtual void Func() {
}
- };
-
+ };
+
class TNonStdLayoutClass3: public TNonStdLayoutClass2 {
- };
-
+ };
+
class TNonStdLayoutClass4: public TEmptyClass {
- public:
- TEmptyClass Base;
- };
+ public:
+ TEmptyClass Base;
+ };
}
#define ASSERT_SAME_TYPE(x, y) \
@@ -131,7 +131,7 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_arithmetic<T*>::value);
bool a;
-
+
a = std::is_same<typename TTypeTraits<T>::TFuncParam, T>::value;
UNIT_ASSERT(a);
a = std::is_same<typename TTypeTraits<const volatile T>::TFuncParam, const volatile T>::value;
@@ -217,7 +217,7 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_empty<TNonEmptyClass>::value);
UNIT_ASSERT(!std::is_empty<TNonEmptyDerivedClass>::value);
}
-
+
Y_UNIT_TEST(TestIsStandardLayout) {
UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass1>::value);
UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass2>::value);
@@ -225,8 +225,8 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass2>::value);
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass3>::value);
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass4>::value);
- }
-
+ }
+
template <class T>
using TTrySum = decltype(std::declval<T>() + std::declval<T>());
@@ -318,32 +318,32 @@ namespace {
};
template <>
- struct TTypeTraitsExpected<TPodClass>: public TTypeTraitsExpected<void> {
+ struct TTypeTraitsExpected<TPodClass>: public TTypeTraitsExpected<void> {
enum { IsClassType = true };
enum { IsVoid = false };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass>: public TTypeTraitsExpected<TPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass>: public TTypeTraitsExpected<TPodClass> {
enum { IsPod = false };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass> {
enum { IsClassType = false };
enum { IsReference = true };
enum { IsLvalueReference = true };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass&&>: public TTypeTraitsExpected<TNonPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass&&>: public TTypeTraitsExpected<TNonPodClass> {
enum { IsClassType = false };
enum { IsReference = true };
enum { IsRvalueReference = true };
};
template <>
- struct TTypeTraitsExpected<const TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass&> {
+ struct TTypeTraitsExpected<const TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass&> {
};
template <>
@@ -416,10 +416,10 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTestNg) {
TYPE_TEST(FloatReference, float&)
TYPE_TEST(FloatConstReference, const float&)
TYPE_TEST(FloatArray, float[17])
- TYPE_TEST(PodClass, TPodClass)
- TYPE_TEST(NonPodClass, TNonPodClass)
- TYPE_TEST(NonPodClassReference, TNonPodClass&)
- TYPE_TEST(NonPodClassConstReference, const TNonPodClass&)
+ TYPE_TEST(PodClass, TPodClass)
+ TYPE_TEST(NonPodClass, TNonPodClass)
+ TYPE_TEST(NonPodClassReference, TNonPodClass&)
+ TYPE_TEST(NonPodClassConstReference, const TNonPodClass&)
}
enum E4 {
diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp
index fc6b46c31a..33a70a7eab 100644
--- a/util/stream/str_ut.cpp
+++ b/util/stream/str_ut.cpp
@@ -1,41 +1,41 @@
-#include "str.h"
-
+#include "str.h"
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/typetraits.h>
-
-template <typename T>
-const T ReturnConstTemp();
-
+#include <util/generic/typetraits.h>
+
+template <typename T>
+const T ReturnConstTemp();
+
Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
Y_UNIT_TEST(Lvalue) {
TString str = "Hello, World!";
- TStringInput input(str);
-
+ TStringInput input(str);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(ConstRef) {
TString str = "Hello, World!";
const TString& r = str;
- TStringInput input(r);
-
+ TStringInput input(r);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(NonConstRef) {
TString str = "Hello, World!";
TString& r = str;
- TStringInput input(r);
-
+ TStringInput input(r);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(Transfer) {
TString inputString = "some_string";
TStringInput input(inputString);
@@ -149,4 +149,4 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
// Check old stream is in a valid state
output1 << "baz";
}
-}
+}