Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/test/core/object/WeakPtrTest.cc

    r9603 r10624  
    4545        test->destroy();
    4646    }
     47
     48    void isNull(const WeakPtr<DestroyableTest> weakPtr)
     49    {
     50        EXPECT_TRUE(weakPtr == NULL);
     51        EXPECT_TRUE(weakPtr == 0);
     52        EXPECT_TRUE(!weakPtr);
     53        EXPECT_FALSE(weakPtr != NULL);
     54        EXPECT_FALSE(weakPtr != 0);
     55        EXPECT_FALSE(weakPtr);
     56    }
     57
     58    TEST(WeakPtrTest, IsNull)
     59    {
     60        {
     61            WeakPtr<DestroyableTest> weakPtr;
     62            isNull(weakPtr);
     63        }
     64        {
     65            WeakPtr<DestroyableTest> weakPtr = NULL;
     66            isNull(weakPtr);
     67        }
     68        {
     69            WeakPtr<DestroyableTest> weakPtr;
     70            weakPtr = NULL;
     71            isNull(weakPtr);
     72        }
     73        {
     74            WeakPtr<DestroyableTest> weakPtr = 0;
     75            isNull(weakPtr);
     76        }
     77        {
     78            WeakPtr<DestroyableTest> weakPtr;
     79            weakPtr = 0;
     80            isNull(weakPtr);
     81        }
     82    }
     83
     84    TEST(WeakPtrTest, IsNotNull)
     85    {
     86        DestroyableTest* test = new DestroyableTest();
     87        WeakPtr<DestroyableTest> weakPtr = test;
     88        EXPECT_FALSE(weakPtr == NULL);
     89        EXPECT_FALSE(weakPtr == 0);
     90        EXPECT_FALSE(!weakPtr);
     91        EXPECT_TRUE(weakPtr != NULL);
     92        EXPECT_TRUE(weakPtr != 0);
     93        EXPECT_TRUE(weakPtr);
     94        test->destroy();
     95    }
    4796}
Note: See TracChangeset for help on using the changeset viewer.