Questions tagged [boost-test]

Boost Test Library is a portable test framework for performing unit testing in c++

271 questions
6
votes
1 answer

How to link boost unit_test library (boost_unit_test_framework)?

I have simple boost unit test snippet: #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE MyTest #include int add(int i, int j) { return i + j; } BOOST_AUTO_TEST_CASE(my_test) { } but by…
Patryk
  • 22,602
  • 44
  • 128
  • 244
6
votes
1 answer

Reporting an exception in Boost::test

Using the boost::test framework, is there a way to detect if an exception (of some type) has been thrown from a function?
There is nothing we can do
  • 23,727
  • 30
  • 106
  • 194
6
votes
0 answers

Eclipse GDB break when named function / symbol arrives at top of stack

Is there a way to make GDB stop at named symbols when they reach the top of the stack? I ask because after the stack frame shown in the picture below, the program seems to execute several functions (too many to step through) without symbol…
Chris Chiasson
  • 547
  • 8
  • 17
6
votes
1 answer

BOOST_DATA_TEST_CASE with fixture support

I'm looking for fixture support in BOOST_DATA_TEST_CASE. I wrote following C++ macros for it, but may be somebody has something better? #include #include #define…
Mikhail Pilin
  • 121
  • 1
  • 5
6
votes
2 answers

Excluding particular tests in Boost.Test

I need a behavior of non-existing option test_launcher --exclude_test='Benchmark*'? Is there a working mechanism in Boost.Test that can be used to achieve the same?
bobah
  • 18,364
  • 2
  • 37
  • 70
6
votes
3 answers

getting all boost test suites / test cases

As the title says, I want to get all test suites or test cases (name) from a test application, ether in the console or as xml output. Test framework is the boost test library. Is there an option to achieve this? I did not found anything useful in…
Felix
  • 2,531
  • 14
  • 25
6
votes
1 answer

Compiler complains about BOOST_CHECK_THROW on constructor

The following does not compile: class Foo { public: Foo( boost::shared_ptr< Bar > arg ); }; // in test-case boost::shared_ptr< Bar > bar; BOOST_CHECK_THROW( Foo( bar ), std::logic_error ); // compiler error here The implementation of Bar…
Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
6
votes
6 answers

Unit Testing Private Method in Resource Managing Class (C++)

I previously asked this question under another name but deleted it because I didn't explain it very well. Let's say I have a class which manages a file. Let's say that this class treats the file as having a specific file format, and contains methods…
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
6
votes
0 answers

Tool to convert Boost unit tests to Google Test (GTest) unit tests?

Is anyone aware of a tool to automatically convert boost test unit tests to GTest? Lots of simple tests look like they could be automatically converted at the very least, saving a lot of time.
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
6
votes
2 answers

Repeat a Boost unit test with different class type

I have two classes which share the exact same API and functionality (they are wrapping different 3rd-party APIs to provide same functionality). The two classes do not have a common base-class/interface. I have a boost unit test for one of them and…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
6
votes
2 answers

Can I get log output only for failures with boost unit tests

I have some logging in my application (it happens to be log4cxx but I am flexible on that), and I have some unit tests using the boost unit test framework. When my unit tests run, I get lots of log output, from both the passing and failing tests…
kdt
  • 27,905
  • 33
  • 92
  • 139
6
votes
2 answers

How to print test summary using boost unit test

Is there a way to print a summary of the tests run in boost unit test. In particular, can a listing of the failed tests be made? I'm having a hard time locating failing tests in the output (especially when the tests have their own output). I already…
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267
5
votes
1 answer

How to expect a static_assert failure and deal with it using Boost.Test framework?

If I have a method accepting a template parameter that should be convertible to, base_of, or same type as the type that is returned, how should I do? For instance, consider this method: template class IFoo { public: template
mister why
  • 1,967
  • 11
  • 33
5
votes
2 answers

How to test a method many times with different parameters each time

I'm learning how to use Boost Test. I want to test the method JulianToGreenWich(float jd): #include class Convert { private: public: Convert(); ~Convert(); tm JulianToGreenWich(float jd); }; To test it with Boost Test, I have…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
5
votes
1 answer

boost test case for function taking user input

I have a function that takes in user input via std::cin: std::getline(std::cin, in); and creates a corresponding data structure by matching it with a regular expression. The function then returns this data structure. I'm using boost.test and I want…
oadams
  • 3,019
  • 6
  • 30
  • 53