aboutsummaryrefslogtreecommitdiffstats
path: root/util/thread/singleton_ut.cpp
blob: 1f5c96f0fd1d03010fb38db34fbc7bacb32152d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <library/cpp/testing/unittest/registar.h>

#include "singleton.h"

namespace {
    struct TFoo {
        int i;
        TFoo()
            : i(0)
        {
        }
    };
} // namespace

Y_UNIT_TEST_SUITE(Tls) {
    Y_UNIT_TEST(FastThread) {
        UNIT_ASSERT_VALUES_EQUAL(0, FastTlsSingleton<TFoo>()->i);
        FastTlsSingleton<TFoo>()->i += 3;
        UNIT_ASSERT_VALUES_EQUAL(3, FastTlsSingleton<TFoo>()->i);
    }
} // Y_UNIT_TEST_SUITE(Tls)