llvm.org GIT mirror llvm / d0dc794
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256518 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 3 years ago
1 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1313
1414 namespace {
1515
16 // Test fixture
17 class PointerIntPairTest : public testing::Test {
18 };
16 TEST(PointerIntPairTest, GetSet) {
17 struct S {
18 };
19 S s;
1920
20 TEST_F(PointerIntPairTest, GetSet) {
21 PointerIntPair Pair(this, 1U);
22 EXPECT_EQ(this, Pair.getPointer());
21 PointerIntPair Pair(&s, 1U);
22 EXPECT_EQ(&s, Pair.getPointer());
2323 EXPECT_EQ(1U, Pair.getInt());
2424
2525 Pair.setInt(2);
26 EXPECT_EQ(this, Pair.getPointer());
26 EXPECT_EQ(&s, Pair.getPointer());
2727 EXPECT_EQ(2U, Pair.getInt());
2828
2929 Pair.setPointer(nullptr);
3030 EXPECT_EQ(nullptr, Pair.getPointer());
3131 EXPECT_EQ(2U, Pair.getInt());
3232
33 Pair.setPointerAndInt(this, 3U);
34 EXPECT_EQ(this, Pair.getPointer());
33 Pair.setPointerAndInt(&s, 3U);
34 EXPECT_EQ(&s, Pair.getPointer());
3535 EXPECT_EQ(3U, Pair.getInt());
3636 }
3737
38 TEST_F(PointerIntPairTest, DefaultInitialize) {
39 PointerIntPair Pair;
38 TEST(PointerIntPairTest, DefaultInitialize) {
39 PointerIntPair Pair;
4040 EXPECT_EQ(nullptr, Pair.getPointer());
4141 EXPECT_EQ(0U, Pair.getInt());
4242 }
4343
44 TEST_F(PointerIntPairTest, ManyUnusedBits) {
44 TEST(PointerIntPairTest, ManyUnusedBits) {
4545 // In real code this would be a word-sized integer limited to 31 bits.
4646 struct Fixnum31 {
4747 uintptr_t Value;