Boost logo

Boost Users :

Subject: Re: [Boost-users] unit test: apply same test case to different fixtures
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-07-08 04:09:07


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Gennadiy Rozental
> Sent: 07 July 2009 14:46
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] unit test: apply same test case to different
> fixtures
>
> Hicham Mouline <hicham <at> mouline.org> writes:
>
> >
> > I have auto test cases that can take fixtures whose members they
> access in a
> > uniform way.
> >
> > Say struct F1... Fn
> >
> > BOOST_FIXTURE_TEST_CASE( test_case1 , F1 ... Fn )
> > {
> > //same code for all Fi
> > }
> >
> > Is there a way to do this?
> >
> > Regards,
> >
>
> 1. Make Fi inherit from Fi+1.
> 2. Use something like this:
>
> template<typename T1,typename T2>
> struct FixtureCollector : T1, T2 {};
>
> You can now either implement above using variardic templates or
> implement macro
> that will convert PP sequence into sequence of
> FixtureCollector<T1,...>:
>
> For example
>
> FIXTURES((T1)(T2)(T3)) should generate:
>
> FixtureCollector<T1,FixtureCollector<T2,T3> >
>
> use it :
>
> BOOST_FIXTURE_TEST_CASE( test_case1 , FIXTURES((T1)(T2)(T3)) )
> {
> }
>
> Gennadiy
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net