aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/adaptor_ut.cpp
diff options
context:
space:
mode:
authorepar <epar@yandex-team.ru>2022-02-10 16:50:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:02 +0300
commit904f1af50fdd9aae658a7b5688b5a497044c4584 (patch)
tree5fc4555525a8451ec9e74fde574490f4c72c8fc5 /util/generic/adaptor_ut.cpp
parent9473a88c91129dfe21343af486bebb93a0b33291 (diff)
downloadydb-904f1af50fdd9aae658a7b5688b5a497044c4584.tar.gz
Restoring authorship annotation for <epar@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/adaptor_ut.cpp')
-rw-r--r--util/generic/adaptor_ut.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/util/generic/adaptor_ut.cpp b/util/generic/adaptor_ut.cpp
index 721f849f93..793e22c2c7 100644
--- a/util/generic/adaptor_ut.cpp
+++ b/util/generic/adaptor_ut.cpp
@@ -1,80 +1,80 @@
-#include "adaptor.h"
-#include "yexception.h"
-
+#include "adaptor.h"
+#include "yexception.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
struct TOnCopy: yexception {
-};
-
+};
+
struct TOnMove: yexception {
-};
-
-struct TState {
- explicit TState() {
- }
-
- TState(const TState&) {
- ythrow TOnCopy();
- }
-
- TState(TState&&) {
- ythrow TOnMove();
- }
-
- void operator=(const TState&) {
- ythrow TOnCopy();
- }
-
- void rbegin() const {
- }
-
- void rend() const {
- }
-};
-
+};
+
+struct TState {
+ explicit TState() {
+ }
+
+ TState(const TState&) {
+ ythrow TOnCopy();
+ }
+
+ TState(TState&&) {
+ ythrow TOnMove();
+ }
+
+ void operator=(const TState&) {
+ ythrow TOnCopy();
+ }
+
+ void rbegin() const {
+ }
+
+ void rend() const {
+ }
+};
+
Y_UNIT_TEST_SUITE(TReverseAdaptor) {
Y_UNIT_TEST(ReadTest) {
TVector<int> cont = {1, 2, 3};
TVector<int> etalon = {3, 2, 1};
- size_t idx = 0;
- for (const auto& x : Reversed(cont)) {
- UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x);
- }
+ size_t idx = 0;
+ for (const auto& x : Reversed(cont)) {
+ UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x);
+ }
idx = 0;
for (const auto& x : Reversed(std::move(cont))) {
UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x);
}
- }
-
+ }
+
Y_UNIT_TEST(WriteTest) {
TVector<int> cont = {1, 2, 3};
TVector<int> etalon = {3, 6, 9};
- size_t idx = 0;
- for (auto& x : Reversed(cont)) {
- x *= x + idx++;
- }
- idx = 0;
- for (auto& x : cont) {
- UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x);
- }
- }
-
+ size_t idx = 0;
+ for (auto& x : Reversed(cont)) {
+ x *= x + idx++;
+ }
+ idx = 0;
+ for (auto& x : cont) {
+ UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x);
+ }
+ }
+
Y_UNIT_TEST(InnerTypeTest) {
using TStub = TVector<int>;
- TStub stub;
- const TStub cstub;
-
- using namespace NPrivate;
+ TStub stub;
+ const TStub cstub;
+
+ using namespace NPrivate;
UNIT_ASSERT_TYPES_EQUAL(decltype(Reversed(stub)), TReverseRange<TStub&>);
UNIT_ASSERT_TYPES_EQUAL(decltype(Reversed(cstub)), TReverseRange<const TStub&>);
- }
-
+ }
+
Y_UNIT_TEST(CopyMoveTest) {
- TState lvalue;
- const TState clvalue;
- UNIT_ASSERT_NO_EXCEPTION(Reversed(lvalue));
- UNIT_ASSERT_NO_EXCEPTION(Reversed(clvalue));
- }
+ TState lvalue;
+ const TState clvalue;
+ UNIT_ASSERT_NO_EXCEPTION(Reversed(lvalue));
+ UNIT_ASSERT_NO_EXCEPTION(Reversed(clvalue));
+ }
Y_UNIT_TEST(ReverseX2Test) {
TVector<int> cont = {1, 2, 3};
@@ -121,4 +121,4 @@ Y_UNIT_TEST_SUITE(TReverseAdaptor) {
UNIT_ASSERT_VALUES_EQUAL(etalon2[idx++], x);
}
}
-}
+}