aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/misc/weak_ptr_ut.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/misc/weak_ptr_ut.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/misc/weak_ptr_ut.cpp')
-rw-r--r--library/cpp/messagebus/misc/weak_ptr_ut.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/messagebus/misc/weak_ptr_ut.cpp b/library/cpp/messagebus/misc/weak_ptr_ut.cpp
index 63d253e128..5a325278db 100644
--- a/library/cpp/messagebus/misc/weak_ptr_ut.cpp
+++ b/library/cpp/messagebus/misc/weak_ptr_ut.cpp
@@ -1,11 +1,11 @@
#include <library/cpp/testing/unittest/registar.h>
-
-#include "weak_ptr.h"
-
+
+#include "weak_ptr.h"
+
Y_UNIT_TEST_SUITE(TWeakPtrTest) {
- struct TWeakPtrTester: public TWeakRefCounted<TWeakPtrTester> {
- int* const CounterPtr;
-
+ struct TWeakPtrTester: public TWeakRefCounted<TWeakPtrTester> {
+ int* const CounterPtr;
+
TWeakPtrTester(int* counterPtr)
: CounterPtr(counterPtr)
{
@@ -13,34 +13,34 @@ Y_UNIT_TEST_SUITE(TWeakPtrTest) {
~TWeakPtrTester() {
++*CounterPtr;
}
- };
-
+ };
+
Y_UNIT_TEST(Simple) {
- int destroyCount = 0;
-
- TIntrusivePtr<TWeakPtrTester> p(new TWeakPtrTester(&destroyCount));
-
- UNIT_ASSERT(!!p);
- UNIT_ASSERT_VALUES_EQUAL(1u, p->RefCount());
-
- TWeakPtr<TWeakPtrTester> p2(p);
-
- UNIT_ASSERT_VALUES_EQUAL(1u, p->RefCount());
-
- {
- TIntrusivePtr<TWeakPtrTester> p3 = p2.Get();
- UNIT_ASSERT(!!p3);
- UNIT_ASSERT_VALUES_EQUAL(2u, p->RefCount());
- }
-
- p.Drop();
- UNIT_ASSERT_VALUES_EQUAL(1, destroyCount);
-
- {
- TIntrusivePtr<TWeakPtrTester> p3 = p2.Get();
- UNIT_ASSERT(!p3);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(1, destroyCount);
- }
-}
+ int destroyCount = 0;
+
+ TIntrusivePtr<TWeakPtrTester> p(new TWeakPtrTester(&destroyCount));
+
+ UNIT_ASSERT(!!p);
+ UNIT_ASSERT_VALUES_EQUAL(1u, p->RefCount());
+
+ TWeakPtr<TWeakPtrTester> p2(p);
+
+ UNIT_ASSERT_VALUES_EQUAL(1u, p->RefCount());
+
+ {
+ TIntrusivePtr<TWeakPtrTester> p3 = p2.Get();
+ UNIT_ASSERT(!!p3);
+ UNIT_ASSERT_VALUES_EQUAL(2u, p->RefCount());
+ }
+
+ p.Drop();
+ UNIT_ASSERT_VALUES_EQUAL(1, destroyCount);
+
+ {
+ TIntrusivePtr<TWeakPtrTester> p3 = p2.Get();
+ UNIT_ASSERT(!p3);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(1, destroyCount);
+ }
+}