aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/atomic/bool_ut.cpp
blob: 9481f41d8dcbedd3af6d97f3089ad01931c15f2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "bool.h"

#include <library/cpp/testing/unittest/registar.h>

Y_UNIT_TEST_SUITE(AtomicBool) {
    Y_UNIT_TEST(ReadWrite) {
        NAtomic::TBool v;

        UNIT_ASSERT_VALUES_EQUAL((bool)v, false);

        v = true;

        UNIT_ASSERT_VALUES_EQUAL((bool)v, true);

        v = false;

        UNIT_ASSERT_VALUES_EQUAL((bool)v, false);

        NAtomic::TBool v2;

        UNIT_ASSERT(v == v2);

        v2 = true;

        UNIT_ASSERT(v != v2);

        v = v2;

        UNIT_ASSERT(v == v2);
    }
}