C++ 如何在Boost测试套件中运行所有已启用的测试

C++ 如何在Boost测试套件中运行所有已启用的测试,c++,unit-testing,boost,C++,Unit Testing,Boost,如何在Boost测试套件中运行所有启用的单元测试?我使用装饰器启用/禁用一些测试 当我以测试套件名称作为说明符运行测试套件时,所有测试都会运行,包括禁用的测试 C++代码(predicate.cpp): 我怎样才能只运行test\u suite\u 1的已启用测试?删除了我的答案,因为显然我的测试失败了,结果只是碰巧看起来不错。看来没有办法了。Boost测试确实可以使用更好的runner界面和文档。我在Boost用户邮件列表中问了这个问题: #define BOOST_TEST_MODULE d

如何在Boost测试套件中运行所有启用的单元测试?我使用装饰器启用/禁用一些测试

当我以测试套件名称作为说明符运行测试套件时,所有测试都会运行,包括禁用的测试

C++代码(
predicate.cpp
):


我怎样才能只运行
test\u suite\u 1
的已启用测试?

删除了我的答案,因为显然我的测试失败了,结果只是碰巧看起来不错。看来没有办法了。Boost测试确实可以使用更好的runner界面和文档。我在Boost用户邮件列表中问了这个问题:
#define BOOST_TEST_MODULE decorator_predicate
#include <boost/test/included/unit_test.hpp>
namespace utf = boost::unit_test;

BOOST_AUTO_TEST_SUITE(test_suite_1)

BOOST_AUTO_TEST_CASE(bare_test)
{
  BOOST_TEST(true);
}

BOOST_AUTO_TEST_CASE(enabled_test,
  * utf::enabled())
{
  BOOST_TEST(true);
}

BOOST_AUTO_TEST_CASE(disabled_test,
  * utf::disabled())
{
  BOOST_TEST(false);
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE(test_suite_2)

BOOST_AUTO_TEST_CASE(bare_test)
{
  BOOST_TEST(true);
}

BOOST_AUTO_TEST_CASE(enabled_test,
  * utf::enabled())
{
  BOOST_TEST(true);
}

BOOST_AUTO_TEST_CASE(disabled_test,
  * utf::disabled())
{
  BOOST_TEST(false);
}

BOOST_AUTO_TEST_SUITE_END()
# Compile the test
g++ predicate.cpp -o predicate

# List all tests
./predicate --list_content
test_suite_1*
    bare_test*
    enabled_test*
    disabled_test 
test_suite_2*
    bare_test*
    enabled_test*
    disabled_test 

# Run the tests that are enabled by default
./predicate
Running 4 test cases...

*** No errors detected

# Here, I would like to only run the enabled tests of test_suite_1.
# Instead, all tests are run. Including the disabled.
./predicate -t test_suite_1
Running 3 test cases...
predicate.cpp(21): error: in "test_suite_1/disabled_test": check false has failed

*** 1 failure is detected in the test module "decorator_predicate"