comparison unittests/Support/ThreadLocalTest.cpp @ 77:54457678186b LLVM3.6

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents
children 60c9769439b8
comparison
equal deleted inserted replaced
34:e874dbf0ad9d 77:54457678186b
1 //===- 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
13 using namespace llvm;
14 using namespace sys;
15
16 namespace {
17
18 class ThreadLocalTest : public ::testing::Test {
19 };
20
21 struct S {
22 int i;
23 };
24
25 TEST_F(ThreadLocalTest, Basics) {
26 ThreadLocal<const S> x;
27
28 EXPECT_EQ(nullptr, x.get());
29
30 S s;
31 x.set(&s);
32 EXPECT_EQ(&s, x.get());
33
34 x.erase();
35 EXPECT_EQ(nullptr, x.get());
36 }
37
38 }