On Saturday 19 July 2014 13:47:14 Damian Vicino wrote:
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 F> class C { T t; M 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
using priority_queue_vector = std::priority_queue , COMPARE_TYPE>; Is it possible to do this with current Boost.Test?
You can create test templates like this: typedef mpl::vector< T1, T2, T3 > types; BOOST_AUTO_TEST_CASE_TEMPLATE(my_test, T, types) { // Here T will be one of the 'types' } In your case you can create an mpl::vector of specializations of your class C you want to test.