boost-test

Controlling output of Boost.Test source location format

情到浓时终转凉″ 提交于 2020-12-07 07:32:52
问题 Catch2 and Boost.Test provide similar features for writing unit tests. For a certain project I have to use Boost.Test instead of Catch2. The problem I have is that both use different format outputs. For example, Catch2 will say that the was a fail in test.cpp:9 (see example below). However Boost.Test will say test.cpp(9): error in ... . This format doesn't allow my editor to recognize the output as a source location. Is there way to make Boost.Test output the source location as file.ext

Controlling output of Boost.Test source location format

梦想的初衷 提交于 2020-12-07 07:32:33
问题 Catch2 and Boost.Test provide similar features for writing unit tests. For a certain project I have to use Boost.Test instead of Catch2. The problem I have is that both use different format outputs. For example, Catch2 will say that the was a fail in test.cpp:9 (see example below). However Boost.Test will say test.cpp(9): error in ... . This format doesn't allow my editor to recognize the output as a source location. Is there way to make Boost.Test output the source location as file.ext

Unit testing non-exported classes in a DLL

孤街浪徒 提交于 2020-06-24 02:59:28
问题 We develop a C++ application using Visual Studio 2008 and unit test using Boost.Test. At the moment, we have a separate solution which contains our unit tests. Many of our projects in the core solution produce DLL's. We're limited in test coverage because we cannot test non-exported classes. I have two ideas on how these could be tested: Export everything Put the tests inside the DLL (same project and solution) and use Boost.Test's external runner I'm not entirely sure what the drawbacks

Unit testing non-exported classes in a DLL

心已入冬 提交于 2020-06-24 02:59:07
问题 We develop a C++ application using Visual Studio 2008 and unit test using Boost.Test. At the moment, we have a separate solution which contains our unit tests. Many of our projects in the core solution produce DLL's. We're limited in test coverage because we cannot test non-exported classes. I have two ideas on how these could be tested: Export everything Put the tests inside the DLL (same project and solution) and use Boost.Test's external runner I'm not entirely sure what the drawbacks

BOOST_CHECK_EQUAL with pair<int, int> and custom operator <<

风格不统一 提交于 2020-01-10 14:28:17
问题 When attempting to do a BOOST_CHECK_EQUAL(pair, pair), gcc doesnt find the stream operator for pair, inspite of declaring it. The funny thing is that std::out finds the operator. ostream& operator<<(ostream& s, const pair<int,int>& p) { s << '<' << p.first << ',' << p.second << '>'; return s; } BOOST_AUTO_TEST_CASE(works) { pair<int,int> expected(5, 5); pair<int,int> actual (5, 5); std::cout << expected << std::endl; std::cout << actual << std::endl; BOOST_CHECK(actual == expected); } BOOST

Get BOOST TEST test suite name inside a test case

ⅰ亾dé卋堺 提交于 2020-01-03 08:24:01
问题 I'm using BOOST TEST and I wonder if there is a way to find out the test suite from inside the test case . I know that I can find test case 's name by: boost::unit_test::framework::current_test_case().p_name Is there a way to find out the suite name also? My suites-cases structure is: suite ---> case 1 ______|--> case 2 ______|--> case 3 Thanks 回答1: A unit_test has not only p_name but also p_parent_id , which is the ID of the test suite. Both those properties are inherited from test_unit ,

How to print test summary using boost unit test

旧城冷巷雨未停 提交于 2020-01-02 06:27:22
问题 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 set BOOST_TEST_LOG_LEVEL in order to show enter/exit, but that isn't enough to locate the failing tests. 回答1: Use the option: --report_level=detailed It will report all your tailing test cases and suites. 来源: https://stackoverflow.com/questions

Where to find the parsed Boost.Test output in Eclipse

落花浮王杯 提交于 2020-01-02 01:10:30
问题 There is already a thread here that partially answers my question . On Eclipse 3.7.2 I followed the approach provided there and I could successfully accomplish the steps creating and setting up a new error parser and adding it to my current project. After executing my Boost.Test (boost rel. 1.48.0) Unit Test, on the Eclipse console I get the same output as the output I get when no parsing is done (e.g. when executing the Unit Test outside Eclipse (e.g. on a Linux terminal)). I searched for a

boost.test vs. CppUnit

淺唱寂寞╮ 提交于 2019-12-31 08:13:34
问题 I've been using CppUnit for quite a while now (and am happy with it). As we are using more and more parts of the boost library I had a short look on boost.test and I'm wondering now if I should switch to boost.test in a new project or not. Can anyone here tell me about the differences between the two frameworks and the benefits (if there are any) of using boost.test? 回答1: Do yourself a favor and go straight to Google Test, which makes CppUnit and boost::unit_test look clunky and repetitive.

CoInitializeEx for a boost::test::unit_test

老子叫甜甜 提交于 2019-12-24 01:41:06
问题 The other day, I decided that I needed to know about test driven development for C++ on the Windows platform (using Visual Studio 2010 Premium). I had a look around before settling on trying out boost's unit test framework. I should say that I opted for boostpro.com's release (current is 1.44 if I recall correctly). This has a build of the static library, so I don't use the DLL in my tests. Boost's unit test documentation talks about seperating your code from your test suite, which seems