BOOST_REQUIREは、テストスイートの現在のテストケースを停止しますが、他のテストケースは続行します。
あなたが「コンパイルされた解決策」を求めたとき、あなたが何を望んでいたのかは本当にわかりませんが、ここにうまくいくはずのトリックがあります。テストスイート全体の安定性をチェックするためにブール値を使用します。不安定な場合、つまりBOOST_REQUIREがトリガーされた場合は、すべてを停止します。
それがあなたを助けることができることを願っています。
//#include <...>
//FIXTURES ZONE
struct fixture
{
fixture():x(0.0),y(0.0){}
double x;
double y;
};
//HELPERS ZONE
static bool test_suite_stable = true;
void in_strategy(bool & stable)
{
if(stable)
{
stable = false;
}
else
{
exit();
}
}
void out_strategy(bool & stable)
{
if(!stable)
{
stable = true;
}
}
BOOST_AUTO_TEST_SUITE(my_test_suite)
//TEST CASES ZONE
BOOST_FIXTURE_TEST_CASE(my_test_case, fixture)
{
in_strategy(test_suite_stable);
//...
//BOOST_REQUIRE() -> triggered
out_strategy(test_suite_stable);
}
BOOST_FIXTURE_TEST_CASE(another_test_case, fixture)
{
in_strategy(test_suite_stable); //-> exit() since last triggered so stable = false
//...
//BOOST_REQUIRE()
out_strategy(test_suite_stable);
}
BOOST_TEST_SUITE_END()
ブノワ。