class FunctionObject
{
public:
- virtual ~FunctionObject() { }
+ virtual ~FunctionObject()
+ {
+
+ }
- virtual void execute(ExpiryTimerImpl::Id) { }
+ virtual void execute(ExpiryTimerImpl::Id)
+ {
+
+ }
};
class ExpiryTimerImplTest: public TestWithMock
TEST_F(ExpiryTimerImplTest, PostThrowsIfDelayIsNegative)
{
- ASSERT_THROW(ExpiryTimerImpl::getInstance()->post(-1, [](ExpiryTimerImpl::Id){}), RCSException);
+ ASSERT_THROW(ExpiryTimerImpl::getInstance()->post(-1,
+ [](ExpiryTimerImpl::Id)
+ {
+ }), RCSException);
}
TEST_F(ExpiryTimerImplTest, PostThrowsIfCallbackIsEmpty)
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Do(
- [this](ExpiryTimerImpl::Id){
+ [this](ExpiryTimerImpl::Id)
+ {
Proceed();
}
);
TEST_F(ExpiryTimerImplTest, CallbackBeInvokedWithTimerId)
{
- ExpiryTimerImpl::Id returnedId;
+ ExpiryTimerImpl::Id returnedId = 0;
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Match(
- [this, &returnedId](ExpiryTimerImpl::Id id){
+ [this, &returnedId](ExpiryTimerImpl::Id id)
+ {
return returnedId == id;
}
).Do(
- [this](ExpiryTimerImpl::Id){
+ [this](ExpiryTimerImpl::Id)
+ {
Proceed();
}
);
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Do(
- [this](ExpiryTimerImpl::Id){
+ [this](ExpiryTimerImpl::Id)
+ {
Proceed();
}
);
TEST_F(ExpiryTimerTest, PostThrowsIfDelayIsNegative)
{
- ASSERT_THROW(timer.post(-1, [](ExpiryTimer::Id){}), RCSException);
+ ASSERT_THROW(timer.post(-1,
+ [](ExpiryTimer::Id)
+ {
+ }), RCSException);
}
TEST_F(ExpiryTimerTest, PostThrowsIfCallbackIsEmpty)
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Do(
- [this](ExpiryTimer::Id){
+ [this](ExpiryTimer::Id)
+ {
Proceed();
}
);
TEST_F(ExpiryTimerTest, CallbackBeInvokedWithTimerId)
{
- ExpiryTimer::Id returnedId;
+ ExpiryTimer::Id returnedId = 0;
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Match(
- [this, &returnedId](ExpiryTimer::Id id){
+ [this, &returnedId](ExpiryTimer::Id id)
+ {
return returnedId == id;
}
).Do(
- [this](ExpiryTimer::Id){
+ [this](ExpiryTimer::Id)
+ {
Proceed();
}
);
FunctionObject* functor = mocks.Mock< FunctionObject >();
mocks.ExpectCall(functor, FunctionObject::execute).Do(
- [this](ExpiryTimer::Id){
+ [this](ExpiryTimer::Id)
+ {
Proceed();
}
);