I am writting Gtest for the Below Setter method and i am getting error while passing a callback method ClientReceiver from Gtest suite. Below are code snippet
namespace BaseClient {
class ClientTop : public JsonClient {
public:
typedef std::function<void(const Json::Value & info)> ReceiverCallBack;
public:
ClientTop(std::string name, int add);
bool Setter(const std::string & value, ReceiverCallBack & listener);
};
}
Here is GTest for the Setter Method. I am getting error while calling ClientTop_Obj->Setter(Value,ClientReceiver) for ClientReceiver parameters
void ClientReceiver(const Json::Value & data){
std::cout<<"Call back received\n";
}
TEST_F(BsrfClientBaseTest,setReceiver) {
std::string value = "Run";
bool ret = ClientTop_Obj->Setter(Value,ClientReceiver);
}
Error Received
error: cannot convert ‘void(const Json::Value&)’ to ‘ReceiverCallBack&’ {aka ‘std::function<void(const Json::Value&)>&’}
Aucun commentaire:
Enregistrer un commentaire