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;