[cleanup] Make this test use a proper fixture rather than globals.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 28 Apr 2014 23:42:22 +0000 (23:42 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 28 Apr 2014 23:42:22 +0000 (23:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207466 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ADT/PointerUnionTest.cpp

index 4dfcb7ea75da32446aee9ebaf5cab803d22193e8..87c60887ad3796c5bf8a2ec80a933320937c8533 100644 (file)
@@ -15,15 +15,14 @@ namespace {
 
 typedef PointerUnion<int *, float *> PU;
 
-// Test fixture
-class PointerUnionTest : public testing::Test {};
+struct PointerUnionTest : public testing::Test {
+  float f;
+  int i;
 
-float f = 3.14f;
-int i = 42;
+  PU a, b, n;
 
-const PU a(&f);
-const PU b(&i);
-const PU n;
+  PointerUnionTest() : f(3.14f), i(42), a(&f), b(&i), n() {}
+};
 
 TEST_F(PointerUnionTest, Comparison) {
   EXPECT_TRUE(a != b);