blob: dd4d706f5cf5223084cbb9cec78cc3cfcc2ca12e [file] [log] [blame]
Hans Wennborgfabf8bf2013-12-19 20:32:44 +00001//===- llvm/unittest/Support/ThreadLocalTest.cpp - Therad Local tests ---===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/Support/ThreadLocal.h"
11#include "gtest/gtest.h"
12
13using namespace llvm;
14using namespace sys;
15
16namespace {
17
18class ThreadLocalTest : public ::testing::Test {
19};
20
21struct S {
22 int i;
23};
24
25TEST_F(ThreadLocalTest, Basics) {
26 ThreadLocal<const S> x;
27
28 EXPECT_EQ(0, x.get());
29
30 S s;
31 x.set(&s);
32 EXPECT_EQ(&s, x.get());
33
34 x.erase();
35 EXPECT_EQ(0, x.get());
36}
37
38}