|
Boost Users : |
From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2003-07-25 01:22:57
> #include <test/included/unit_test_framework.hpp>
better be
#include <boost/test/included/unit_test_framework.hpp>
Don't you afraid naming conflict?
> using boost::unit_test_framework::test_suite;
>
> class baseTrailTest{
> public:
> baseTrailTest(){};
> ~baseTrailTest(){};
you need virtual ~baseTrailTest(){};
> protected :
This makes trail() protected and inaccessible at point where you
refer to it.
> void trail(){
> cout << " trail!!!! " << endl;
> }
> };
>
> class TrailTest: public baseTrailTest{
You may use
public:
using baseTrailTest::trail;
to provide access to trail();
> };
>
> 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);
You need boost::shared_ptr<baseTrailTest> 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