Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disabling selected boost unit tests?

2 views
Skip to first unread message

carl

unread,
Nov 28, 2009, 9:35:19 AM11/28/09
to
I have made a few boost unit-tests.

#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>

// Boost Test declaration and Checking macros
#include <boost/test/unit_test_suite.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/floating_point_comparison.hpp>


BOOST_AUTO_TEST_SUITE(my_tests);
BOOST_AUTO_TEST_SUITE();


BOOST_AUTO_TEST_CASE(test_1)
{

}


BOOST_AUTO_TEST_CASE(test_2)
{

}

BOOST_AUTO_TEST_CASE(test_3)
{


}


Now when I run the unit-test all 3 test are executed. But is it possible
somehow to specify that only test 2 should be run?

Gert-Jan de Vos

unread,
Nov 28, 2009, 10:34:08 AM11/28/09
to

Run your test executable like this:

test --run_test=test_2

It is in "User's Guide" -> "Runtime configuration" -> "Run by name" in
the documentation.

carl

unread,
Nov 29, 2009, 8:18:22 AM11/29/09
to

"Gert-Jan de Vos" <gert-ja...@onsneteindhoven.nl> wrote in message
news:615f2601-352a-4e50...@f16g2000yqm.googlegroups.com...

test --run_test=test_2


Ok so its not possible to define a unit-test "main" function inside the
unit-test where the test to run is specified manually. I am using Visual
Studion and when I press run it automatically runs all the test. As an
alternative I can setup the run command to accept a runtime argument, but
its rather time consuming compared to outcomment a single line or two in the
source file.

carl

unread,
Nov 29, 2009, 8:21:32 AM11/29/09
to

"carl" <carl@.com> wrote in message
news:4b1274aa$0$273$1472...@news.sunsite.dk...

Something like this:

http://www.ncbi.nlm.nih.gov/bookshelf/br.fcgi?book=toolkit&part=ch_boost#ch_boost.Disabling_Tests_Expl


Disabling Tests Explicitly in Code

The NCBI extensions include a macro, NCBITEST_DISABLE, to unconditionally
disable a test case or suite. This macro must be placed in the
NCBITEST_INIT_TREE function:
NCBITEST_INIT_TREE()
{
NCBITEST_DISABLE(test_case_name);
NCBITEST_DISABLE(test_suite_name);
}


0 new messages