I had a C++11 code for processing requests and an UT using gmock that matchs those parameters request. The processor method was overloaded for all types os data process, something like :
obj.process(T1 p1);
obj.process(T2 p2);
obj.process(T3 p3, T4 p4);
But now the types of data process grew a lot and I tought that could be simpler if it has only one processing interface:
obj.process(std::function<void(void)> CMD);
My problem now is writing an Unit Test. How can I match the processor interface with its expected parameters?
EXPECT_CALL(obj,process(MATCH???);
My match must be against something like:
auto p1 = [&](void) { process1(T1 val)}; // an specific val
auto p2 = [&](void) { process3(T2 val)}; // an specific val
auto p3 = [&](void) { process3(p3,p4)}; // an specific val
Aucun commentaire:
Enregistrer un commentaire