
Hi, I am a boost unit test newbie. I have been looking at the documentation and examples and would like to know if there is any documentation that specifically addresses the use of mock objects: I am specifically interested in how to interpret the output of est_example1.cpp and est_example2.cpp; as well as learning what the required format of the expectations log file (.elog) to be used for logged_exp_example.cpp is. Thank you, Mike ____________________________________________________________ Nutrition Improve your career health. Click now to study nutrition! http://thirdpartyoffers.netzero.net/TGL2241/c?cp=U1sp_d8XptT4jkLd7e_KlAAAJ1H...

Michael Robinson <michaelrobinson <at> netzero.net> writes:
Hi,
I am a boost unit test newbie.
I have been looking at the documentation and examples and would like to know if there is any documentation that specifically addresses the use of mock objects:
Unfortunately, no.
I am specifically interested in how to interpret the output of est_example1.cpp
This example demonstrates how you can count how many execution path exists in your function under the test. Just run it with --log_level=message
and est_example2.cpp;
This example illustrates how to use mocks to test for basic and strong exception safety. If any errors detected on particular execution path, the path is printed. For example .../boost/test/mock_object.hpp(209): error in "test_stack_push": 1 memory leak detected in the execution path 9:
"mock_object::mock_object" < "mock_object::mock_object" "mock_object::mock_object" < "mock_object::mock_object" "stack::stack" < "stack::stack" "stack::push" "mock_object::operator =" < "mock_object::operator =" < "stack::push" "stack::push" "mock_object::operator =" < "mock_object::operator =" < "stack::push" "stack::push" Allocated memory block 0x0036CC20, 4 bytes long: <....> CD CD CD CD "mock_object::mock_object" < "mock_object::mock_object" "mock_object::mock_object" < "mock_object::mock_object" "mock_object::mock_object" < "mock_object::mock_object" "mock_object::mock_object" < "mock_object::mock_object" "mock_object::operator =" Forced failure: Copy assignment < "mock_object::operator =" < "stack::push"
Here "> scope name" designate where we enter some scope and "< scope name" designate where we are leaving one.
as well as learning what the required format of the expectations log file (.elog) to be used for logged_exp_example.cpp is.
The good thing about the solution is that you do not really need to know the format. You run the test first with --save_pattern=yes and the expectations are logged into pattern file. Next time you run the test interactions are validated against these logged expectations. The format is pretty straightforward, but I hope above answers your question. Gennadiy

On Fri, 2010-01-22 at 01:27 -0500, Gennadiy Rozental wrote:
The format is pretty straightforward, but I hope above answers your question.
Your answers are extremely helpful, thank you very much! Mike ____________________________________________________________ Home Improvement Projects Improve your home. Click for products, services, and project ideas. http://thirdpartyoffers.netzero.net/TGL2241/c?cp=4EeWwFwdcE4qvK7s2iBhqwAAJ1H...
participants (2)
-
Gennadiy Rozental
-
Michael Robinson