diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2015-12-28 20:03:16 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2015-12-28 20:03:16 +0000 |
| commit | 8a01ebda8c19eb66d96eb9d23b365ac92a8ecd26 (patch) | |
| tree | 795e7f4b232d46c7332fb16fc89a1102e9a56a8e /llvm/unittests/ADT/PointerIntPairTest.cpp | |
| parent | 5910a00039ad3da7a5b6de8a4201cd3ec8306bd0 (diff) | |
| download | llvm-8a01ebda8c19eb66d96eb9d23b365ac92a8ecd26.zip llvm-8a01ebda8c19eb66d96eb9d23b365ac92a8ecd26.tar.gz llvm-8a01ebda8c19eb66d96eb9d23b365ac92a8ecd26.tar.bz2 | |
[ADT] Don't use a fixture just to get a nonce type for this unittest.
Instead, actually produce a nonce type in the test and use that. This
makes the test, IMO, both simpler and more clear.
llvm-svn: 256518
Diffstat (limited to 'llvm/unittests/ADT/PointerIntPairTest.cpp')
| -rw-r--r-- | llvm/unittests/ADT/PointerIntPairTest.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/unittests/ADT/PointerIntPairTest.cpp b/llvm/unittests/ADT/PointerIntPairTest.cpp index 0bbcd9f..956c250 100644 --- a/llvm/unittests/ADT/PointerIntPairTest.cpp +++ b/llvm/unittests/ADT/PointerIntPairTest.cpp @@ -14,35 +14,35 @@ using namespace llvm; namespace { -// Test fixture -class PointerIntPairTest : public testing::Test { -}; +TEST(PointerIntPairTest, GetSet) { + struct S { + }; + S s; -TEST_F(PointerIntPairTest, GetSet) { - PointerIntPair<PointerIntPairTest *, 2> Pair(this, 1U); - EXPECT_EQ(this, Pair.getPointer()); + PointerIntPair<S *, 2> Pair(&s, 1U); + EXPECT_EQ(&s, Pair.getPointer()); EXPECT_EQ(1U, Pair.getInt()); Pair.setInt(2); - EXPECT_EQ(this, Pair.getPointer()); + EXPECT_EQ(&s, Pair.getPointer()); EXPECT_EQ(2U, Pair.getInt()); Pair.setPointer(nullptr); EXPECT_EQ(nullptr, Pair.getPointer()); EXPECT_EQ(2U, Pair.getInt()); - Pair.setPointerAndInt(this, 3U); - EXPECT_EQ(this, Pair.getPointer()); + Pair.setPointerAndInt(&s, 3U); + EXPECT_EQ(&s, Pair.getPointer()); EXPECT_EQ(3U, Pair.getInt()); } -TEST_F(PointerIntPairTest, DefaultInitialize) { - PointerIntPair<PointerIntPairTest *, 2> Pair; +TEST(PointerIntPairTest, DefaultInitialize) { + PointerIntPair<float *, 2> Pair; EXPECT_EQ(nullptr, Pair.getPointer()); EXPECT_EQ(0U, Pair.getInt()); } -TEST_F(PointerIntPairTest, ManyUnusedBits) { +TEST(PointerIntPairTest, ManyUnusedBits) { // In real code this would be a word-sized integer limited to 31 bits. struct Fixnum31 { uintptr_t Value; |
