Opened 15 years ago

Closed 15 years ago

#1311 closed Bugs (fixed)

Can't call base members on derived object in unit_test

Reported by: anonymous Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.34.1 Severity: Showstopper
Keywords: Cc:

Description

#include <iostream> #include "boost/test/unit_test.hpp" #include "boost/shared_ptr.hpp" # using std::cout; using std::endl; using boost::shared_ptr; using boost::unit_test::test_suite;

class BaseClass {

public:

void test_me() { cout << "hello" << endl; }

};

class TestClass:public BaseClass {

public:

};

test_suite* init_unit_test_suite( int argc, char* argv[] ) {

test_suite* test= BOOST_TEST_SUITE( "Example" ); shared_ptr<TestClass> instance( new TestClass ); test->add( BOOST_CLASS_TEST_CASE( &TestClass::BaseClass::test_me, instance ) ); return test;

} /usr/include/boost/test/unit_test_suite.hpp: In function ‘boost::unit_test::test_suite* init_unit_test_suite(int, char)’:

/usr/include/boost/test/unit_test_suite.hpp:220: error: too many arguments to function ‘boost::unit_test::test_case* boost::unit_test::make_test_case(const boost::unit_test::callback0<boost::unit_test::ut_detail::unused>&, boost::unit_test::const_string)’

Change History (2)

comment:1 by John Maddock, 15 years ago

Component: Nonetest
Owner: set to Gennadiy Rozental

comment:2 by Gennadiy Rozental, 15 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.