blob: c1735b3339ceb3be1349b06849f3eb32bbcf33a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <library/cpp/testing/unittest/registar.h>
#include "latch.h"
Y_UNIT_TEST_SUITE(TLatch) {
Y_UNIT_TEST(Simple) {
TLatch latch;
UNIT_ASSERT(latch.TryWait());
latch.Lock();
UNIT_ASSERT(!latch.TryWait());
latch.Lock();
latch.Lock();
UNIT_ASSERT(!latch.TryWait());
latch.Unlock();
UNIT_ASSERT(latch.TryWait());
latch.Unlock();
latch.Unlock();
UNIT_ASSERT(latch.TryWait());
}
}
|