Well, despite some problems with getting the Check target to run, I feel confident enough with my gtest build to go ahead and follow these instructions:
Once you are able to compile the Google Test library, you should create a project or build target for your test program. Make sure you have GTEST_ROOT/include in the header search path so that the compiler can find "gtest/gtest.h" when compiling your test. Set up your test project to link with the Google Test library (for example, in Visual Studio, this is done by adding a dependency on gtest.vcproj).Being as I'm still a XCode newb, I have to suffer the pain of learning the meanings of terms like “header search path”. I'll just tell you the answer FWIW.
So. I start by creating something skeletal and incomplete to test. This will do:
Please pardon my C++ as well. It's been a while.
The secret header sauce is to set the USER_HEADER_SEARCH_PATHS to GTEST_HOME/include (recursive search), like this:
Which gets us to the point where we can write a test like this:
And configure it to compile and link correctly like this:>
Now I just have to figure out how to run the tests... But that's a task for tomorrow - other work intercedes.
No comments:
Post a Comment