"Chris Miceli"
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
#include 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
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 is incorrect way to register test units.
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
I am not sure how it worked before, but the correct way to implement this is
to use init function
#include <iostream>
#define BOOST_TEST_DYN_LINK
#include