Boost logo

Boost Users :

From: Chris Miceli (cmicel1_at_[hidden])
Date: 2007-09-11 11:04:20


I have had nothing but troubles with boost test 1.34.1 after switched
from 1.33. First I had trouble with the main from shared object issue,
and now my code that worked before is not executing a test added to the
framework.

#include <iostream>
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE File Test
#include <boost/bind.hpp>
#include <boost/test/unit_test.hpp>

template <typename Functor>
struct my_test
{
    void execute(int value)
    {
        //Never prints this message
        //Doesn't have to be a print, nothing gets here
        std::cerr << "Hi all" << std::endl << std::flush;
    }
};

BOOST_AUTO_TEST_CASE( test123 )
{
     boost::shared_ptr<my_test<int> > tester(new my_test<int>);
     
boost::unit_test::framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&my_test<int>::execute,
tester, 5)));
}

this worked when it was not using boost::bind but just the address of a
normal function. This is just an simple version that illustrated the
problem. I am compiling as such
g++ test.cpp -o test -L/usr/local/lib -lboost_unit_test_framework-gcc41-mt

This is the output:

Running 1 test case...

*** No errors detected


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