aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/atomic/bool_ut.cpp
blob: 08286d20a473eb095485b8ee92694c17fae6ab04 (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);
    }
}