Hello everybody,
I just pushed my latest revision to the calitko-BitTorrent branch. I’ve again done some work related to our improving our unit-tests by providing a framework that helps us write our tests in a more natural way. I found that what I want to do is very similar to the idea of Mock Objects but also differs a little bit. I thought about modifying mockpp for my purposes but to me it seems it would be easier and better to do the implementation myself. I expect the result would be simpler than mockpp.
I haven’t committed the Loki library because I plan not to use it anymore in the next revision, so you won’t be able to build the source. What would be interesting to look at is how I use functors as members of the driver and mock classes and then call them as normal functions. This approach allowed me to write very little code in the driver and mock classes, however it has a very important shortcoming – it won’t work for overloaded functions. Or it could work but the syntax would be very complex.
It would also be interesting for you to look in Utils/Testing/CallBinderFactory.h and see how I use the preprocessor to write 10 different template specializations of two different classes in about 200 lines. I’m not sure that’s the best style to do that but it’s short :-). It would have been really great it the C++ preprocessor was programmable as well… you see it is quite handy to have the preprocessor generate the code for the template specializations.
I’ll keep you updated.
Regards,
Peter
