Boost logo

Boost Users :

From: rudugani (rudugani_at_[hidden])
Date: 2003-07-23 10:58:51


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 <iostream.h>

/*-------------------- BOOST FRAMEWORK --------------------- */

#include <test/included/unit_test_framework.hpp>
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_suite> test( BOOST_TEST_SUITE( "example" ) );

       /*if( argc < 2 )
           return (test_suite*)0;*/

       test->add( new trail_test_suite);
       
   return test.release();
}


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