|
Boost : |
From: Hubert Holin (Hubert.Holin_at_[hidden])
Date: 2003-01-30 09:25:18
Somewhere in the E.U., le 30/01/2003
Bonjour
OK, I tried to use the following advice:
In article
<1373D6342FA1D4119A5100E029437F6401169ED7_at_[hidden]>,
"Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote:
> > template<typename T>
> > class atanh_tester
> > {
> > public:
> > atanh_tester(char *)
> > {
> > }
> >
> > void operator () ()
> > {
> > // whatever
> > }
> > };
> >
> > how can I add a test case to "test" buit from an instance of
> > atanh_tester<float> ?
>
> Use unit_test_suite_ex.hpp. It allows to supply boost::function0<void> as a
> test case.
>
> See unit_test_suite_ex_test.cpp for example.
>
> Gennadiy.
I am stumbling on another problem, though.
Given
boost::unit_test_framework::test_suite * test = BOOST_TEST_SUITE("");
if I have the following normal function
void fn(int)
{
}
then I can do the following
test->add(BOOST_TEST_CASE(::boost::bind(&fn, 1)));
but if I have a templated functions instead
template<typename T>
void ft(int)
{
}
then the following invocation will not compile
test->add(BOOST_TEST_CASE(::boost::bind(&ft<int>, 1)));
the error message being
Error : function call 'bind(void, int)' does not match
'boost::bind<...>(__T1)'
'boost::bind<...>(__T1, __T2)'
'boost::bind<...>(__T1, __T2, __T3)'
'boost::bind<...>(__T1, __T2, __T3, __T4)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5, __T6)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5, __T6, __T7)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8,
__T9)'
'boost::bind<...>(__T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8,
__T9, __T10)'
'boost::bind<...>(__T0)'
'boost::bind<...>(__T0, __T1)'
'boost::bind<...>(__T0, __T1, __T2)'
'boost::bind<...>(__T0, __T1, __T2, __T3)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4, __T5)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4, __T5, __T6)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7,
__T8)'
'boost::bind<...>(__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7,
__T8, __T9)'
'boost::bind<...>(__T0 (*)())'
'boost::bind<...>(__T0 (*)(__T1), __T2)'
'boost::bind<...>(__T0 (*)(__T1, __T2), __T3, __T4)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3), __T4, __T5, __T6)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4), __T5, __T6, __T7,
__T8)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4, __T5), __T6, __T7,
__T8, __T9, __T10)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4, __T5, __T6), __T7,
__T8, __T9, __T10, __T11, __T12)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4, __T5, __T6, __T7),
__T8, __T9, __T10, __T11, __T12, __T13, __T14)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4, __T5, __T6, __T7,
__T8), __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16)'
'boost::bind<...>(__T0 (*)(__T1, __T2, __T3, __T4, __T5, __T6, __T7,
__T8, __T9), __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17,
__T18)'
'boost::bind<...>(__T0 (__T1::*)()const , __T2)'
'boost::bind<...>(__T0 (__T1::*)()const , __T2)'
'boost::bind<...>(__T0 (__T1::*)(__T2)const , __T3, __T4)'
'boost::bind<...>(__T0 (__T1::*)(__T2)const , __T3, __T4)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3)const , __T4, __T5, __T6)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3)const , __T4, __T5, __T6)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4)const , __T5, __T6,
__T7, __T8)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4)const , __T5, __T6,
__T7, __T8)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5)const , __T6,
__T7, __T8, __T9, __T10)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5)const , __T6,
__T7, __T8, __T9, __T10)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6)const ,
__T7, __T8, __T9, __T10, __T11, __T12)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6)const ,
__T7, __T8, __T9, __T10, __T11, __T12)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6,
__T7)const , __T8, __T9, __T10, __T11, __T12, __T13, __T14)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6,
__T7)const , __T8, __T9, __T10, __T11, __T12, __T13, __T14)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6, __T7,
__T8)const , __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6, __T7,
__T8)const , __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6, __T7,
__T8, __T9)const , __T10, __T11, __T12, __T13, __T14, __T15, __T16,
__T17, __T18)'
'boost::bind<...>(__T0 (__T1::*)(__T2, __T3, __T4, __T5, __T6, __T7,
__T8, __T9)const , __T10, __T11, __T12, __T13, __T14, __T15, __T16,
__T17, __T18)'
'boost::bind<...>(__T0 __T1::*, __T2)'
special_functions_test.cpp line 75
boost::unit_test_framework::create_test_case((::boost::bind(&ft<int>,
1)), "::boost::bind(&ft<int>, 1)" )
Merci
HH
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk