void CTest_Poster::testConstructAndDeleteL() { { auto_ptr<CPoster> poster( CPoster::NewL(*iJabberData, *iStorage, *iPresenceHolder) ); TS_ASSERT( poster.get() ); } }
/** * \brief tests the wait method with an inital count set to zero */ TEST(Semaphore, waitTestDefaultConstructor){ OS::SSemaphore uut; SemaphorePoster poster(&uut); CHECK_EQUAL(uut.getSemaphoreCount(), 0); //Zero by default poster.start(); uut.wait(); CHECK(poster.getPosted()); //If it gets here, the test was successful, as the program didn't hang poster.join(); //Wait for thread to exit CHECK_EQUAL(uut.getSemaphoreCount(), 0); //Should stay at zero }
void CTest_Poster::testPostCommentL() { auto_ptr<CPoster> poster( CPoster::NewL(*iJabberData, *iStorage, *iPresenceHolder) ); TS_ASSERT( poster.get() ); const TInt KUidGeneratorId(1); auto_ptr<CUuidGenerator> generator( CUuidGenerator::NewL(iJabberData->UserNickL(), KUidSymbianOsUnit, KUidGeneratorId) ); TGlobalId parentId; generator->MakeUuidL( parentId ); poster->PostCommentToItemL(parentId, _L("Autogenerated unit test comment") ); }
void test() { #if 2 // clumsy workaround auto nested = boost::protect(boost::bind(&MyClass::func, this, 7, 42)); typedef decltype(nested) actual_t; // _bi::protected_bind_t<bind_t<void, mf2<void, MyClass, int, int>, list3<value<MyClass *>, value<int>, value<int> > > > typedef void (boost::asio::io_service::*pmf)(actual_t const&); boost::bind(static_cast<pmf>(&boost::asio::io_service::post), &ios_, nested); #else // more elegant TMP solution boost::bind(poster(ios_), boost::protect(boost::bind(&MyClass::func, this, 7, 42))); #endif }