-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Greg Christopher Sent: Wednesday, July 08, 2009 10:02 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Boost.Test] [1.38] Automated test suite registration with muti-file-test-modules
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Friday, July 03, 2009 11:48 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Boost.Test] [1.38] Automated test suie registration with muti-file-test-modules
Greg Christopher
writes: This is covered in docs I believe. BOOST_TEST_MODULE has similar effect as BOOST_TEST_MAIN, but also define the name of the master test suite Since I don't really need to define the name of the master test suite, I will not use BOOST_TEST_MODULE.
As it turns out, that still does not yield a working example. I then have no init_unit_test_suite() Please post an example and how you build it. The example is basically the same example that was posted earlier: Test1.cpp: #include "stdafx.h"
#define BOOST_TEST_MAIN Yes // Remove this line and we stop working
#include
#include BOOST_AUTO_TEST_SUITE(foo1)
BOOST_AUTO_TEST_CASE(foo1case) { BOOST_CHECK(4 == 4); }
BOOST_AUTO_TEST_SUITE_END() Test2.cpp #include "stdafx.h"
#include
#include #define BOOST_TEST_MODULE Yeah
BOOST_AUTO_TEST_SUITE(foo2)
BOOST_AUTO_TEST_CASE(foo2case) { BOOST_CHECK(4 == 4); }
BOOST_AUTO_TEST_SUITE_END()
Now when you link to the static version of the lib you get this:
1>libboost_unit_test_framework-vc90-mt-gd-1_38.lib(unit_test_main.obj) : error LNK2019: unresolved external symbol "class boost::unit_test::test_suite * __cdecl init_unit_test_suite(int,char * * const)" (?init_unit_test_suite@@YAPAVtest_suite@unit_test@boost@@HQAPAD@Z) referenced in function _main
Project is a simple Visual Studio 2008 one using static version of boost:
http://www.easy-share.com/1906667710/basic.zip
Thanks, Greg This is how I usually do the automated test suite registration with multi-file test modules, I arrange my files as follows:
file1.cpp
#include