Пример проверки унарной функции , вероятно, то, что вам нужно. Единственным недостатком является то, что автоматическая регистрация (может быть основана на какой-то заводской функции), кажется, не поддерживается для этого.
У них также есть шаблон тестового примера , который имеет автоматическую регистрацию, поэтому можно было бы злоупотребить им, определив тип для каждой конфигурации, если их не слишком много.
Редактировать: шаблон теста можно использовать примерно так:
// Parameter is the type of parameter you need. Might be anything from simple int (in
// which case the template parameter may be a value, not reference) to complex object.
// It just has to be possible to create (static) global instances of it.
template <const Parameter ¶m>
struct Fixture {
// do whatever you want, param is normal object reference here
// it's not a member, but you can:
const Parameter &getParameter() { return param; }
}
static Parameter p1(whatever);
static Parameter p2(something_else);
// ...
typedef boost::mpl::list<Fixture<p1>, Fixture<p2> > Fixtures;
BOOST_AUTO_TEST_CASE_TEMPLATE(test, F, Fixtures)
{
F fixture; // Unfortunately you can't make it true fixture, so you have to have instance
// Test what you want
}