Questions tagged [boost-test]

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

271 questions
3
votes
0 answers

How to show Boost Test test case hierarchy in Visual Studio 2017's Test Explorer?

I have a unit test file using Boost Test, like so: #include #include #include namespace { struct S { static auto count() -> int& { static int c; return c; } S(){…
Cheers and hth. - Alf
  • 142,714
  • 15
  • 209
  • 331
3
votes
1 answer

How to set which Boost unit test to run

I am trying to use boost-test, and in particular boost unit testing. I clearly don't understand how is the main function generated and called, all the tutorial says is to define a module and write a test #define BOOST_TEST_MODULE…
0x26res
  • 11,925
  • 11
  • 54
  • 108
3
votes
2 answers

Unit-tests for Boost.Spirit

I'm new to Boost.Spirit and Boost.Test and I would like to know how you verify the correctness of your grammars. Below is a simplified version of how I do it at the moment and I'm pretty sure that there's a better way: Each test case hase a pair of…
Konrd
  • 682
  • 5
  • 10
3
votes
1 answer

Testing with boost

Can someone write step by step what to do to start using testing facilities from boost? For example I have a class: class A { public: int multiplyByTwo(const int input) { return input * 2; } }; and I would like to set test cases for multiplyByTwo…
There is nothing we can do
  • 23,727
  • 30
  • 106
  • 194
3
votes
3 answers

What is the better way to generate test report in a file using BOOST.Test?

I know by default report is directed to standard-error, and so one has to redirect it to a file. My question is shall we do this inside a global fixture? Which isn't seem to be working for me some how. This is what i tried - struct MyConfig { …
Hemant
  • 726
  • 6
  • 17
3
votes
1 answer

How global fixtures work in BOOST.Test?

I have started using BOOST recently for unit testing. Just need one clarification on global fixtures. When it got executed? ... for each test module, or each test suite or each test case? Will it be the first before any thing else got executed? I am…
Hemant
  • 726
  • 6
  • 17
3
votes
5 answers

Can I cause a compile error on "too few initializers"?

I am using an aggregate initializer to set up a block of static data for a unit test. I would like to use the array size as the expected number of elements, but this can fail if too few initializers are provided: my_struct_type expected[14] = { …
mskfisher
  • 3,291
  • 4
  • 35
  • 48
3
votes
1 answer

Boost.Test - problems overriding main

I want to provide my own main function while using Boost.Test. So I have included the following macros: #define BOOST_TEST_ALTERNATIVE_INIT_API #define BOOST_TEST_NO_MAIN In my main function I have a call to:…
ksl
  • 4,519
  • 11
  • 65
  • 106
3
votes
2 answers

How can I tell if any BOOST_CHECK tests have failed so far?

I have a boost test case that does some checks using BOOST_CHECK*, so failures don't immediately stop the test. But at some point, I'd like to stop if any test failures have occurred so far, because the rest of the test is pointless to run if the…
Tavian Barnes
  • 12,477
  • 4
  • 45
  • 118
3
votes
2 answers

Simultaneously running 2 or more boost testcases belonging to different test suites via cmd

Consider the following scenario: BOOST_AUTO_TEST_SUITE(suite1) { BOOST_AUTO_TEST_CASE(case1) { //my test code here } } BOOST_AUTO_TEST_SUITE(suite2) { BOOST_AUTO_TEST_CASE(case1) { //my test code here } …
CinCout
  • 9,486
  • 12
  • 49
  • 67
3
votes
2 answers

Does the Boost testing framework support test dependencies?

One of my favorite unit testing frameworks is PHPUnit because it supports test dependencies (i.e. the ability to mark tests as dependent upon other tests, running the dependent tests conditionally on the success of their dependencies). I've been…
churay
  • 340
  • 2
  • 5
  • 16
3
votes
1 answer

try catch blocks with boost.Test

I have a (Class member) function which I wish to avoid app crash due to ambiguity. For that purpose I have added a try catch bock as shown below: void getGene(unsigned int position){ T val; try { val = _genome.at(_isCircular ?…
Nikhil J Joshi
  • 1,177
  • 2
  • 12
  • 25
3
votes
1 answer

Is there a standard way to colorize the output of boost::test

I am working on a set of C++ unit tests in boost::test. After working with the Google test framework, I really appreciate the ability to quickly visually parse colorized output in order to tighten the development cycle. Currently, I'm considering…
Andrew Prock
  • 6,900
  • 6
  • 40
  • 60
3
votes
1 answer

cmake can't find boost lib

I want to cross compile a simple main.cpp that uses boost libs (regex), The target plataform it's a raspberry pi (raspbian). I have installed from apt-get the libboost-all-dev package. So the headers were in the raspi. Then from another tutorial, I…
Vitor Carvalho
  • 335
  • 1
  • 5
  • 11
3
votes
2 answers

Using BoostTest with C++/CLI : possible or not?

I have a Visual Studio project containing the code of a program (a model). I have created an other project to put the boost tests in it. The problem is that I can't get it to work. I can use the boost tests alone in the project, but as soon as I…
gpalex
  • 826
  • 1
  • 11
  • 27