aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/guard_ut.cpp
diff options
context:
space:
mode:
authorSergey Polovko <sergey@polovko.me>2022-02-10 16:47:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:03 +0300
commit2e714b5ebd40a1f4cc31c27f1ad6e49ca6d895f5 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /util/system/guard_ut.cpp
parent3e0b762a82514bac89c1dd6ea7211e381d8aa248 (diff)
downloadydb-2e714b5ebd40a1f4cc31c27f1ad6e49ca6d895f5.tar.gz
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2.
Diffstat (limited to 'util/system/guard_ut.cpp')
-rw-r--r--util/system/guard_ut.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp
index cab4ca9e37..404ede99ab 100644
--- a/util/system/guard_ut.cpp
+++ b/util/system/guard_ut.cpp
@@ -13,7 +13,7 @@ struct TTestGuard: public TTestBase {
UNIT_TEST(TestSync)
UNIT_TEST(TestUnguard)
UNIT_TEST(TestTryReadGuard)
- UNIT_TEST(TestWithLock)
+ UNIT_TEST(TestWithLock)
UNIT_TEST(TestWithLockScope);
UNIT_TEST_SUITE_END();
@@ -119,11 +119,11 @@ struct TTestGuard: public TTestBase {
{
TTryGuard<TGuardChecker> guard(checker);
UNIT_ASSERT(checker.guarded);
- UNIT_ASSERT(guard.WasAcquired());
- {
+ UNIT_ASSERT(guard.WasAcquired());
+ {
TTryGuard<TGuardChecker> guard2(checker);
UNIT_ASSERT(checker.guarded);
- UNIT_ASSERT(!guard2.WasAcquired());
+ UNIT_ASSERT(!guard2.WasAcquired());
}
UNIT_ASSERT(checker.guarded);
}
@@ -152,21 +152,21 @@ struct TTestGuard: public TTestBase {
TTryReadGuard tryGuard(mutex);
UNIT_ASSERT(tryGuard.WasAcquired());
}
-
- int WithLockIncrement(TGuardChecker& m, int n) {
+
+ int WithLockIncrement(TGuardChecker& m, int n) {
with_lock (m) {
- UNIT_ASSERT(m.guarded);
- return n + 1;
- }
- }
-
- void TestWithLock() {
- TGuardChecker m;
- int n = 42;
- n = WithLockIncrement(m, n);
- UNIT_ASSERT(!m.guarded);
- UNIT_ASSERT_EQUAL(n, 43);
- }
+ UNIT_ASSERT(m.guarded);
+ return n + 1;
+ }
+ }
+
+ void TestWithLock() {
+ TGuardChecker m;
+ int n = 42;
+ n = WithLockIncrement(m, n);
+ UNIT_ASSERT(!m.guarded);
+ UNIT_ASSERT_EQUAL(n, 43);
+ }
void TestWithLockScope() {
auto Guard = [](auto) { UNIT_FAIL("Non global Guard used"); return 0; };