Google Mock for iPhone development?
I have an interesting situation where I am refactoring a bunch of ObjC iPhone code to create a C++ API. I'm a novice to C++ and looking into C++ mocking frameworks to augment the work I'd done using OCUnit and poor man's mocks. I ran across googlemock and wanted to know if anyone has ever used it for iPhone development? Also, how can I share this (or mockpp) with other devs as it is an installable package and doesn't seem to lend itself to checking into a 开发者_如何学Pythonrepository?
I've never used Googlemock for iPhone development, but have used it plenty on Windows and various UNIXes.
It uses standard modern C++ with TC1 (Technical Corrigenda 1) so can compile on any up to date, compliant compiler.
If your development environment doesn't implement TC1, then Google also include a subset of the Boost library that implements Tuples, which is the part of TC1 that Googlemock depends on.
Basically, if your compiler can handle templates, it should be able to handle Googlemock.
You can download the full source from Googlecode and this is what you might want to check into your repository.
For the Objective-C code you might consider Kiwi (http://www.kiwi-lib.info/mocks_and_stubs.html). It is a great bdd framework with nice mock/stub support.
精彩评论