summaryrefslogtreecommitdiffstats
path: root/util/thread/lfqueue_ut.cpp
diff options
context:
space:
mode:
authorgridem <[email protected]>2022-02-10 16:52:11 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:52:11 +0300
commitc033c991ec51e667180ad54477994acf76cd9c37 (patch)
tree690c0903ed41ca3ba2a133c65288309924a77a88 /util/thread/lfqueue_ut.cpp
parent86b9a8049c23ddce4d975be32bf7655109467697 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/thread/lfqueue_ut.cpp')
-rw-r--r--util/thread/lfqueue_ut.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/util/thread/lfqueue_ut.cpp b/util/thread/lfqueue_ut.cpp
index 83bca100cf9..ca454e86a6a 100644
--- a/util/thread/lfqueue_ut.cpp
+++ b/util/thread/lfqueue_ut.cpp
@@ -51,57 +51,57 @@ private:
int Value_ = 0;
};
-class TOperationsChecker {
-public:
- TOperationsChecker() {
+class TOperationsChecker {
+public:
+ TOperationsChecker() {
++DefaultCtor_;
- }
-
- TOperationsChecker(TOperationsChecker&&) {
+ }
+
+ TOperationsChecker(TOperationsChecker&&) {
++MoveCtor_;
- }
-
- TOperationsChecker(const TOperationsChecker&) {
+ }
+
+ TOperationsChecker(const TOperationsChecker&) {
++CopyCtor_;
- }
-
- TOperationsChecker& operator=(TOperationsChecker&&) {
+ }
+
+ TOperationsChecker& operator=(TOperationsChecker&&) {
++MoveAssign_;
- return *this;
- }
-
- TOperationsChecker& operator=(const TOperationsChecker&) {
+ return *this;
+ }
+
+ TOperationsChecker& operator=(const TOperationsChecker&) {
++CopyAssign_;
- return *this;
- }
-
- static void Check(int defaultCtor, int moveCtor, int copyCtor, int moveAssign, int copyAssign) {
- UNIT_ASSERT_VALUES_EQUAL(defaultCtor, DefaultCtor_);
- UNIT_ASSERT_VALUES_EQUAL(moveCtor, MoveCtor_);
- UNIT_ASSERT_VALUES_EQUAL(copyCtor, CopyCtor_);
- UNIT_ASSERT_VALUES_EQUAL(moveAssign, MoveAssign_);
- UNIT_ASSERT_VALUES_EQUAL(copyAssign, CopyAssign_);
- Clear();
- }
-
-private:
- static void Clear() {
- DefaultCtor_ = MoveCtor_ = CopyCtor_ = MoveAssign_ = CopyAssign_ = 0;
- }
-
- static int DefaultCtor_;
- static int MoveCtor_;
- static int CopyCtor_;
- static int MoveAssign_;
- static int CopyAssign_;
-};
-
-int TOperationsChecker::DefaultCtor_ = 0;
-int TOperationsChecker::MoveCtor_ = 0;
-int TOperationsChecker::CopyCtor_ = 0;
-int TOperationsChecker::MoveAssign_ = 0;
-int TOperationsChecker::CopyAssign_ = 0;
-
+ return *this;
+ }
+
+ static void Check(int defaultCtor, int moveCtor, int copyCtor, int moveAssign, int copyAssign) {
+ UNIT_ASSERT_VALUES_EQUAL(defaultCtor, DefaultCtor_);
+ UNIT_ASSERT_VALUES_EQUAL(moveCtor, MoveCtor_);
+ UNIT_ASSERT_VALUES_EQUAL(copyCtor, CopyCtor_);
+ UNIT_ASSERT_VALUES_EQUAL(moveAssign, MoveAssign_);
+ UNIT_ASSERT_VALUES_EQUAL(copyAssign, CopyAssign_);
+ Clear();
+ }
+
+private:
+ static void Clear() {
+ DefaultCtor_ = MoveCtor_ = CopyCtor_ = MoveAssign_ = CopyAssign_ = 0;
+ }
+
+ static int DefaultCtor_;
+ static int MoveCtor_;
+ static int CopyCtor_;
+ static int MoveAssign_;
+ static int CopyAssign_;
+};
+
+int TOperationsChecker::DefaultCtor_ = 0;
+int TOperationsChecker::MoveCtor_ = 0;
+int TOperationsChecker::CopyCtor_ = 0;
+int TOperationsChecker::MoveAssign_ = 0;
+int TOperationsChecker::CopyAssign_ = 0;
+
Y_UNIT_TEST_SUITE(TLockFreeQueueTests) {
Y_UNIT_TEST(TestMoveEnqueue) {
TMoveTest value(0xFF, 0xAA);
@@ -317,17 +317,17 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueTests) {
UNIT_ASSERT_VALUES_EQUAL(1, p.RefCount());
}
-
+
Y_UNIT_TEST(CheckOperationsCount) {
- TOperationsChecker o;
- o.Check(1, 0, 0, 0, 0);
- TLockFreeQueue<TOperationsChecker> queue;
- o.Check(0, 0, 0, 0, 0);
- queue.Enqueue(std::move(o));
- o.Check(0, 1, 0, 0, 0);
- queue.Enqueue(o);
- o.Check(0, 0, 1, 0, 0);
- queue.Dequeue(&o);
- o.Check(0, 0, 2, 1, 0);
- }
+ TOperationsChecker o;
+ o.Check(1, 0, 0, 0, 0);
+ TLockFreeQueue<TOperationsChecker> queue;
+ o.Check(0, 0, 0, 0, 0);
+ queue.Enqueue(std::move(o));
+ o.Check(0, 1, 0, 0, 0);
+ queue.Enqueue(o);
+ o.Check(0, 0, 1, 0, 0);
+ queue.Dequeue(&o);
+ o.Check(0, 0, 2, 1, 0);
+ }
}