hi,
Essentially what I'm trying to do(the code is attached below) , is
pass a base class member pointer (member function should
automatically be visible in the derived class) , to the BOOST
framework.
However, since the member function is statically not visible in the
derived class, a compile time error is generated .
I'm *thinking* that some kind of casting operation is required but
not very sure how!
could anybody enlighten me as to how to get the code snippet below
running?
Thanks!
CODE:
#include
/*-------------------- BOOST FRAMEWORK --------------------- */
#include
using boost::unit_test_framework::test_suite;
class baseTrailTest{
public:
baseTrailTest(){};
~baseTrailTest(){};
protected :
void trail(){
cout << " trail!!!! " << endl;
}
};
class TrailTest: public baseTrailTest{
};
struct trail_test_suite : public test_suite {
trail_test_suite() : test_suite("trail_test_suite") {
// add member function test cases to a test suite
boost::shared_ptr<TrailTest> instance(new TrailTest);
add( BOOST_CLASS_TEST_CASE( &TrailTest::trail ,instance ), 0 );
}
};
test_suite*
init_unit_test_suite( int argc, char * argv[] ) {
std::auto_ptr test( BOOST_TEST_SUITE( "example" ) );
/*if( argc < 2 )
return (test_suite*)0;*/
test->add( new trail_test_suite);
return test.release();
}