aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/vector_ut.cpp
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /util/generic/vector_ut.cpp
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'util/generic/vector_ut.cpp')
-rw-r--r--util/generic/vector_ut.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp
index 0f6b4037a0..59ed6f3b95 100644
--- a/util/generic/vector_ut.cpp
+++ b/util/generic/vector_ut.cpp
@@ -34,7 +34,7 @@ class TYVectorTest: public TTestBase {
private:
void TestConstructorsAndAssignments() {
- using container = TVector<int>;
+ using container = TVector<int>;
container c1;
c1.push_back(100);
@@ -69,12 +69,12 @@ private:
}
inline void TestTildeEmptyToNull() {
- TVector<int> v;
+ TVector<int> v;
UNIT_ASSERT_EQUAL(nullptr, v.data());
}
inline void TestTilde() {
- TVector<int> v;
+ TVector<int> v;
v.push_back(10);
v.push_back(20);
@@ -94,7 +94,7 @@ private:
// Copy-paste of STLPort tests
void Test1() {
- TVector<int> v1; // Empty vector of integers.
+ TVector<int> v1; // Empty vector of integers.
UNIT_ASSERT(v1.empty() == true);
UNIT_ASSERT(v1.size() == 0);
@@ -110,8 +110,8 @@ private:
UNIT_ASSERT(v1[0] == 42);
{
- TVector<TVector<int>> vect(10);
- TVector<TVector<int>>::iterator it(vect.begin()), end(vect.end());
+ TVector<TVector<int>> vect(10);
+ TVector<TVector<int>>::iterator it(vect.begin()), end(vect.end());
for (; it != end; ++it) {
UNIT_ASSERT((*it).empty());
UNIT_ASSERT((*it).size() == 0);
@@ -122,10 +122,10 @@ private:
}
void Test2() {
- TVector<double> v1; // Empty vector of doubles.
+ TVector<double> v1; // Empty vector of doubles.
v1.push_back(32.1);
v1.push_back(40.5);
- TVector<double> v2; // Another empty vector of doubles.
+ TVector<double> v2; // Another empty vector of doubles.
v2.push_back(3.56);
UNIT_ASSERT(v1.size() == 2);
@@ -150,7 +150,7 @@ private:
}
void Test3() {
- using vec_type = TVector<char>;
+ using vec_type = TVector<char>;
vec_type v1; // Empty vector of characters.
v1.push_back('h');
@@ -173,7 +173,7 @@ private:
}
void Test4() {
- TVector<int> v(4);
+ TVector<int> v(4);
v[0] = 1;
v[1] = 4;
@@ -197,7 +197,7 @@ private:
void Test5() {
int array[] = {1, 4, 9, 16};
- TVector<int> v(array, array + 4);
+ TVector<int> v(array, array + 4);
UNIT_ASSERT(v.size() == 4);
@@ -210,8 +210,8 @@ private:
void Test6() {
int array[] = {1, 4, 9, 16, 25, 36};
- TVector<int> v(array, array + 6);
- TVector<int>::iterator vit;
+ TVector<int> v(array, array + 6);
+ TVector<int>::iterator vit;
UNIT_ASSERT(v.size() == 6);
UNIT_ASSERT(v[0] == 1);
@@ -251,8 +251,8 @@ private:
int array1[] = {1, 4, 25};
int array2[] = {9, 16};
- TVector<int> v(array1, array1 + 3);
- TVector<int>::iterator vit;
+ TVector<int> v(array1, array1 + 3);
+ TVector<int>::iterator vit;
vit = v.insert(v.begin(), 0); // Insert before first element.
UNIT_ASSERT(*vit == 0);
@@ -301,7 +301,7 @@ private:
void TestCapacity() {
{
- TVector<int> v;
+ TVector<int> v;
UNIT_ASSERT(v.capacity() == 0);
v.push_back(42);
@@ -311,7 +311,7 @@ private:
}
{
- TVector<int> v(Reserve(100));
+ TVector<int> v(Reserve(100));
UNIT_ASSERT(v.capacity() >= 100);
UNIT_ASSERT(v.size() == 0);
@@ -319,15 +319,15 @@ private:
{
//Test that used to generate an assertion when using __debug_alloc.
- TVector<TestStruct> va;
+ TVector<TestStruct> va;
va.reserve(1);
va.reserve(2);
}
}
void TestAt() {
- TVector<int> v;
- TVector<int> const& cv = v;
+ TVector<int> v;
+ TVector<int> const& cv = v;
v.push_back(10);
UNIT_ASSERT(v.at(0) == 10);
@@ -347,27 +347,27 @@ private:
}
void TestPointer() {
- TVector<int*> v1;
- TVector<int*> v2 = v1;
- TVector<int*> v3;
+ TVector<int*> v1;
+ TVector<int*> v2 = v1;
+ TVector<int*> v3;
v3.insert(v3.end(), v1.begin(), v1.end());
}
void TestAutoRef() {
- TVector<int> ref;
+ TVector<int> ref;
for (int i = 0; i < 5; ++i) {
ref.push_back(i);
}
- TVector<TVector<int>> v_v_int(1, ref);
+ TVector<TVector<int>> v_v_int(1, ref);
v_v_int.push_back(v_v_int[0]);
v_v_int.push_back(ref);
v_v_int.push_back(v_v_int[0]);
v_v_int.push_back(v_v_int[0]);
v_v_int.push_back(ref);
- TVector<TVector<int>>::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end());
+ TVector<TVector<int>>::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end());
for (; vvit != vvitEnd; ++vvit) {
UNIT_ASSERT(*vvit == ref);
}
@@ -391,8 +391,8 @@ private:
};
void TestIterators() {
- TVector<int> vint(10, 0);
- TVector<int> const& crvint = vint;
+ TVector<int> vint(10, 0);
+ TVector<int> const& crvint = vint;
UNIT_ASSERT(vint.begin() == vint.begin());
UNIT_ASSERT(crvint.begin() == vint.begin());
@@ -418,7 +418,7 @@ private:
}
void TestShrink() {
- TVector<int> v;
+ TVector<int> v;
v.resize(1000);
v.resize(10);
v.shrink_to_fit();
@@ -436,7 +436,7 @@ private:
// representation making executable crash on vector destructor invocation.
// We prefer a simple memory leak, internal corruption should be reveal
// by size or capacity checks.
- using V = TVector<int>;
+ using V = TVector<int>;
V* pv1 = new V(1, 1);
V* pv2 = new V(10, 2);
@@ -459,7 +459,7 @@ private:
void TestFillInConstructor() {
for (int k = 0; k < 3; ++k) {
- TVector<int> v(100);
+ TVector<int> v(100);
UNIT_ASSERT_VALUES_EQUAL(100u, v.size());
for (size_t i = 0; i < v.size(); ++i) {
UNIT_ASSERT_VALUES_EQUAL(0, v[i]);
@@ -517,7 +517,7 @@ private:
constexpr bool ALLOW_UNINITIALIZED = false;
#endif
- TVector<T, TDebugAlloc<T>> v;
+ TVector<T, TDebugAlloc<T>> v;
v.reserve(5);
auto firstBegin = v.begin();
@@ -564,7 +564,7 @@ private:
TestYResize<TNonPod>();
}
- void CheckInitializeList(const TVector<int>& v) {
+ void CheckInitializeList(const TVector<int>& v) {
for (size_t i = 0; i < v.size(); ++i) {
UNIT_ASSERT_EQUAL(v[i], static_cast<int>(i));
}
@@ -572,21 +572,21 @@ private:
void TestInitializeList() {
{
- TVector<int> v;
+ TVector<int> v;
v.assign({0, 1, 2});
CheckInitializeList(v);
}
{
- TVector<int> v = {0, 1, 2};
+ TVector<int> v = {0, 1, 2};
CheckInitializeList(v);
}
{
- TVector<int> v;
+ TVector<int> v;
v = {0, 1, 2};
CheckInitializeList(v);
}
{
- TVector<int> v = {0, 3};
+ TVector<int> v = {0, 3};
v.insert(v.begin() + 1, {1, 2});
CheckInitializeList(v);
}