Boost logo

Boost :

Subject: [boost] [boost-test] question about using templates for tests
From: Damian Vicino (damian.vicino_at_[hidden])
Date: 2014-07-19 13:47:14


Hi,
I’m trying to test a template with different parameters and I can’t figure out how to do it for the following case.

My class is something like this:
template<class T, class M,
         template<class, class> class F>
class C
{
        T t;
        M m;
        F<T, std::shared_ptr<C<T, M, F>;
        Public:
        …
}

So my test, should receive 3 template classes, first 2 normal classes and a third which receives 2 Template Parameters.

For now I’m just duplicating the tests for each implementation I write for F and they pass.
Anyway, it is starting to be hard to maintain, a template solution would be great.

F is suppose to receive a priority_queue like parameter, something getting a value and a comparison operator.
For example, this is one of the parameters I’m testing with:
template <class VALUE_TYPE, class COMPARE_TYPE>
using priority_queue_vector = std::priority_queue<VALUE_TYPE, std::vector<VALUE_TYPE>, COMPARE_TYPE>;

Is it possible to do this with current Boost.Test?

Thanks in advance


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk