Discussion:
[Boost] Command Line to run a specific Boost Test Case using BOOST_AUTO_TEST_CASE_TEMPLATE
Hemanth Choudary M V (RBEI/ETA1)
2013-09-10 05:24:49 UTC
Permalink
Hi,

I would like to run this boost test case using the command line.
Please note that the list contains data types that have 2 or more words.
I need to know what to pass in the Command Line for -run_test=__________


#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>

//____________________________________________________________________________//

typedef boost::mpl::list<long long,unsigned char> test_types;

BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
{
BOOST_CHECK_EQUAL( sizeof(T), (unsigned)4 );
}

//_


Mit freundlichen Grüßen / Best Regards,
Hemanth Choudary MV
RBEI/ETA1
Gennadiy Rozental
2013-09-11 04:26:47 UTC
Permalink
Hemanth Choudary M V (RBEI/ETA1 <HemanthChoudary.MV <at> in.bosch.com>
Post by Hemanth Choudary M V (RBEI/ETA1)
Hi,
 
I would like to run this boost test case using the command line.
Please note that the list contains data types  that have 2 or more words.
I need to know what to pass in the Command Line for –run_test=__________
 
typedef boost::mpl::list<long long,unsigned char> test_types;
 
BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
{
    BOOST_CHECK_EQUAL( sizeof(T), (unsigned)4 );
}
You actually have 2 test cases here. To run one you'll need to do this:

test.exe --run_test="my_test<long long>"

to run all:

test.exe --run_test="my_test*"

(tested on windows with latest trunk, but I believe it should work in
release version as well).

Gennadiy
legalize+ (Richard)
2013-12-29 06:45:56 UTC
Permalink
[Please do not mail me a copy of your followup]
Post by Hemanth Choudary M V (RBEI/ETA1)
I would like to run this boost test case using the command line.
Please note that the list contains data types that have 2 or more words.
I need to know what to pass in the Command Line for -run_test=__________
If you run the test executable with --report_level=detailed you will
see the names of all the suites and tests cases as the execution
proceeeds.

You can also use this to debug arguments to --run_test.

With your code on Windows and boost 1.53 I get the following output
Post by Hemanth Choudary M V (RBEI/ETA1)
ConsoleApplication1.exe --report_level=detailed
Running 2 test cases...
d:/code/tmp/consoleapplication1/consoleapplication1/main.cpp(13): error in "my_test<__int64>": check sizeof(T) == (unsigned)4 failed [8 != 4]
d:/code/tmp/consoleapplication1/consoleapplication1/main.cpp(13): error in "my_test<unsigned char>": check sizeof(T) == (unsigned)4 failed [1 != 4]

Test suite "example" failed with:
2 assertions out of 2 failed
2 test cases out of 2 failed

Test case "my_test<__int64>" failed with:
1 assertion out of 1 failed

Test case "my_test<unsigned char>" failed with:
1 assertion out of 1 failed

Note that boost.test turned "long long" into "__int64", which may be
why you had difficulty specifying the name of the test.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Loading...