c++ - 当 boost 自动测试用例名称中包含逗号时,boost 会抱怨:“测试设置错误:没有匹配过滤器的测试用例或所有测试用例都被禁用”
问题描述
使用 boost::mpl 时,测试用例模板没有运行(我假设是因为逗号)。
该代码在 boost 1.55 中工作,因为正在使用的测试用例名称是模板的错位名称。但是升级到 boost 1.64 的 demangled 名称现在被用作测试用例名称 IE:
test_case<foo<A,B>>
代码使用这个模板
template <bool arg1, typename arg2>
struct test_template: public arg2
{
static const bool isEnabled = arg1;
};
代码现在声明了一个包含两个实例化模板的 mpl 容器。
using test_templates = boost::mpl::vector<
test_template<true, SPECIALIZED>,
test_template<false, GENERIC>> ;
该代码使用 BOOST_AUTO_TEST_CASE_TEMPLATE 自动注册测试用例。
BOOST_AUTO_TEST_CASE_TEMPLATE(my_test, T, test_templates )
{
BOOST_TEST( sizeof(T) == (unsigned)4 );
//This will fail but this test case will not run at all in this example.
}
现在测试用例将被命名:
my_test<test_template<true,_SPECIALIZED>>
my_test<test_template<false,_GENERIC>>
由于测试用例名称中包含逗号,因此 boost.test 遇到了问题。
这段代码在 boost 1.55 中可以正常工作,因为 boost 使用实例化模板的错位名称分配了测试用例名称(这是一个长而奇怪的名称,但没有逗号)
有任何想法吗?我查看了 boost 文档,似乎没有任何关于在 mpl 中使用多个参数模板进行 boost 测试的消息。
解决方案
推荐阅读
- excel - 如果另一个单元格具有值验证,则需要单元格
- java - 当用户在Java中输入数组的大小时,如何生成从0到100的随机数而不重复?
- coinbase-api - 什么是coinbase pro api相当于https://www.bitmex.com/api/v1/instrument/active
- python - InvalidRequestException 在使用 get_query_results 尽管获得 HTTPStatusCode: 200 当我之前运行 start_query_execution
- apollo - 当我使用 apollo 从端点获取数据时,如何增加 100 限制?
- flutter - 在导航回上一个屏幕之前无法隐藏/处置键盘
- python-3.x - “进程以退出代码 139 完成(被信号 11:SIGSEGV 中断)”的中断?
- c++ - 如何为 objcpp .mm 文件启用单独的统一构建?
- java - 如何让事件处理程序跟踪用户单击它的次数?
- html - 如何使用 css 动态填充 svg 数组