Hi,
 
Scenario1:
Both files are present in the same Project BoostUnitTest.
fileA:
typedef boost::mpl::list<long long,unsigned char> test_types;
 
BOOST_AUTO_TEST_SUITE(MySuite)
BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
{
    BOOST_CHECK_EQUAL( sizeof(T), (unsigned)4 );
}
BOOST_AUTO_TEST_SUITE_END()
 
fileB:
typedef boost::mpl::list<long long,unsigned char> test_types;
 
BOOST_AUTO_TEST_SUITE(MySuite)
BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
{
    BOOST_CHECK_EQUAL( sizeof(T), (unsigned)4 );
}
BOOST_AUTO_TEST_SUITE_END()
 
 
As shown above, MySuite is extended across 2 files fileA and fileB. The BOOST_AUTO_TEST_CASE_TEMPLATE name is same across the both the files and and the suite name is also same across both the files..
 
Boost is able to differentiate between the 2 test cases and the test cases are executed.
 
Scenario2:
fileA:
BOOST_AUTO_TEST_SUITE(MySuite)
BOOST_AUTO_TEST_CASE( my_test)
{
    BOOST_CHECK_EQUAL(1,1);
}
BOOST_AUTO_TEST_SUITE_END()
 
 
fileB:
 
BOOST_AUTO_TEST_SUITE(MySuite)
BOOST_AUTO_TEST_CASE_TEMPLATE( my_test )
{
    BOOST_CHECK_EQUAL( 1,1 );
}
BOOST_AUTO_TEST_SUITE_END()
 
In the scenario2, I get a compile time error (Error 1 error LNK2005: "public: void __thiscall mySuite::insuite2::test_method(void)" (?test_method@insuite2@mySuite@@QAEXXZ) already defined in BoostUnitTest.obj) which basically suggests that one or more multiply defined symbols are found.
 
Why is the behaviour different in these 2 scenarios? How is Boost able to differenciate between the 2 test cases in Scenario1?
 
Mit freundlichen Grüßen / Best Regards,
Hemanth Choudary MV
RBEI/ETA1