[llvm] r207468 - [cleanup] Add some actual positive tests for equality. This unittest

Chandler Carruth chandlerc at gmail.com
Mon Apr 28 16:44:14 PDT 2014


Author: chandlerc
Date: Mon Apr 28 18:44:14 2014
New Revision: 207468

URL: http://llvm.org/viewvc/llvm-project?rev=207468&view=rev
Log:
[cleanup] Add some actual positive tests for equality. This unittest
never actually compared for equality two pointer unions that were equal.
Fortunately, things seem to work. =]

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=207468&r1=207467&r2=207468&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/PointerUnionTest.cpp (original)
+++ llvm/trunk/unittests/ADT/PointerUnionTest.cpp Mon Apr 28 18:44:14 2014
@@ -19,14 +19,18 @@ struct PointerUnionTest : public testing
   float f;
   int i;
 
-  PU a, b, n;
+  PU a, b, c, n;
 
-  PointerUnionTest() : f(3.14f), i(42), a(&f), b(&i), n() {}
+  PointerUnionTest() : f(3.14f), i(42), a(&f), b(&i), c(&i), n() {}
 };
 
 TEST_F(PointerUnionTest, Comparison) {
+  EXPECT_TRUE(a == a);
+  EXPECT_FALSE(a != a);
   EXPECT_TRUE(a != b);
   EXPECT_FALSE(a == b);
+  EXPECT_TRUE(b == c);
+  EXPECT_FALSE(b != c);
   EXPECT_TRUE(b != n);
   EXPECT_FALSE(b == n);
 }





More information about the llvm-commits mailing list