[llvm] r207466 - [cleanup] Make this test use a proper fixture rather than globals.

Chandler Carruth chandlerc at gmail.com
Mon Apr 28 16:42:22 PDT 2014


Author: chandlerc
Date: Mon Apr 28 18:42:22 2014
New Revision: 207466

URL: http://llvm.org/viewvc/llvm-project?rev=207466&view=rev
Log:
[cleanup] Make this test use a proper fixture rather than globals.

Modified:
    llvm/trunk/unittests/ADT/PointerUnionTest.cpp

Modified: llvm/trunk/unittests/ADT/PointerUnionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/PointerUnionTest.cpp?rev=207466&r1=207465&r2=207466&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/PointerUnionTest.cpp (original)
+++ llvm/trunk/unittests/ADT/PointerUnionTest.cpp Mon Apr 28 18:42:22 2014
@@ -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);





More information about the llvm-commits mailing list