Boost logo

Boost :

Subject: Re: [boost] [boost-test] question about using templates for tests
From: Damian Vicino (damian.vicino_at_[hidden])
Date: 2014-07-19 15:38:23

I read it this example in the documentation

> You can create test templates like this:
> typedef mpl::vector< T1, T2, T3 > 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.

If I understood wheel the documentation that will run 3 different tests with T1, T2 and T3 as the T of the test.

Maybe my previous problem is easier to explain if I break it in 2 different questions:

1. How can I pass more than one T to the test, in my case I need 3 Ts in the test which each has different values.

A simpler scenario in this case would be trying to test this:
T1 a;
T2 b;
BOOST_CHECK(a+b == b+a);
And suppose I want to run the test with 4 combinations of parameters:
T1=int, T2=float
T1=float, T2=int
T1=int, T2=int
T1=float, T2=float

2. The other problem is that one of the Ts in my example is a "template<class, class> class” and I can’t find the way to make it even compile using that kind of type in the example from the documentation.

Boost list run by bdawes at, gregod at, cpdaniel at, john at