Questions tagged [boost-test]

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

271 questions
1
vote
0 answers

Is there a way to make sure a Boost.Test test can fail when it ought to?

I recently discovered a bug in one of my tests - it would always pass even when it should have failed. Is there a way to use the Boost.Test framework to require that a test fails when given inputs for which it is expected to fail? (I don't want to…
A_K
  • 457
  • 3
  • 11
1
vote
1 answer

Setting a test-wide tolerance with BOOST_DATA_TEST_CASE_F

Within a BOOST_FIXTURE_TEST_CASE, you can set a tolerance for all BOOST_TEST calls like so: BOOST_FIXTURE_TEST_CASE(Testname, SomeFixture, *utf::tolerance(.01)) However, I cannot find a way to make this work with BOOST_DATA_TEST_CASE_F. From…
clocksw
  • 68
  • 5
1
vote
1 answer

Disabling specific test instance defined from a dataset

Let's say I have the following test code: struct MyData { MyData( int in_, double out_ ) : m_in{ in_ } , m_out{ out_ } {} int m_in; double m_out; }; std::ostream& operator<<( std::ostream& os_, MyData data_ ) { os_…
BobMorane
  • 3,870
  • 3
  • 20
  • 42
1
vote
0 answers

Boost test fixture parameter

I want to write a parametrised unit test using boost::test. Preferably I'd like to pass parameters to my fixture class. I write multiple test cases with the same setup and tear-down scenarios, so it'd be pretty handy. Unfortunately, I'm aware that…
Patryk
  • 136
  • 8
1
vote
0 answers

Is there a way to ensure lazy evaluation of BOOST_TESTs message?

Is it possible to ensure that the message macro parameter of BOOST_TEST is only evaluated, if the check actually fails. Lazy evaluation seems to happen for human readable output format, but not for JUnit output format. Can I somehow make lazy…
fabian
  • 80,457
  • 12
  • 86
  • 114
1
vote
2 answers

BOOST TEST: Custom << operator for std::vector type?

I've just started to learn Boost Test library (and C++ also). I have this code inside a source file: #include #include #include #include "../../MyLibrary/Matrices.h" std::ostream&…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
1
vote
1 answer

Writing unit tests which may access private/protectedstate

I use Boost Test for unit tests. I typically have a fixture struct: class ClassBeingTested { protected: int _x; // Want to access this directly in my unit tests }; struct TestFixture : public ClassBeingTested { // I can access…
user997112
  • 29,025
  • 43
  • 182
  • 361
1
vote
0 answers

Multiple definion main in boost

I download mingw complier with boost how it was there Setup Boost in Clion Then I started to test my lab and get multiple definition of `main', because my lab has main and C:/MinGw/include/boost/test/impl/unit_test_main.ipp: has main. If I commet…
1
vote
1 answer

VSCode dynamic linking - C++ Boost Test

I'm trying to get a Boost Unit Test program to run in VSCode, but I'm having trouble linking the library. I've written a simple unit test setup with two classes, Boost Test, and FakeIt mocking framework, and easily verified that it works in VS2017.…
Tachyon
  • 121
  • 3
  • 13
1
vote
1 answer

Boost unit test fixture inheriting test class, to have access to protected methods?

I have worked with Google Test/GTest previously, which I am sure allowed your text fixture class to inherit the class you were testing, so it could have access to the protected methods of the class being tested (without them needing to be exposed as…
user997112
  • 29,025
  • 43
  • 182
  • 361
1
vote
0 answers

Boost Test Framework: Any way to get a backtrace on SIGSEV?

Just starting out with boost test framework. Using Ubuntu + gcc (running on Windows through the new thing if that matters). When I run my tests, I get this: unknown location(0): fatal error: in "PhraseListTest/everythingEqual8": signal: SIGSEGV,…
Robert Fraser
  • 10,649
  • 8
  • 69
  • 93
1
vote
1 answer

How to test Qt application with Boost Unit Test framework

Is it possible to write unit tests for Qt application for example QCoreApplication to test it's functions that are invoked in arbitrary time? Let's suppose that I want to test member function of my class like void…
Miszo97
  • 303
  • 2
  • 11
1
vote
3 answers

problem with boost.test with old version

I'm trying to use boost.test on a remote system with boost 1.33.1. On my pc this little example from http://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/tutorials/hello-the-testing-world.html works: #define BOOST_TEST_MODULE MyTest #include…
Ruggero Turra
  • 16,929
  • 16
  • 85
  • 141
1
vote
2 answers

I don't want to stop test when access violation in test with boost library

When occur to access violation in unit test with boost test library. and then, test was aborted, and finished. But, I don't want to stop the unit test. Just I want to get exception or notification. How do I? Thank you, and please understad my fool…
cardbt
  • 223
  • 1
  • 3
  • 8
1
vote
1 answer

Exception Error at the line BOOST_AUTO_TEST_SUITE_END()

i have a problem with the boost-test from my teacher. When i'm debugging my project i get an error at this Line: BOOST_AUTO_TEST_SUITE_END() The Exception is the following: 0x7521b727 (KernelBase.dll) in homework2.exe: 0xC0020001: The string…
demonking
  • 2,584
  • 5
  • 23
  • 28