Search code examples
c++boostboost-test

boost::test and verifying code is executed


I have a test that is successful (among other things) if a certain callback is run exactly N times. Of course, I can write a bit of code to count how many times the callback is run and then execute a boost::test case against that condition. But this has arisen so often I wonder if I've missed some support for this in boost::test.

Many thanks for any tips.


Solution

  • You should be able to accomplish that with mock objects. Turtle is a mock library that integrates quite well with Boost::Test.