【发布时间】:2020-11-29 22:08:50
【问题描述】:
我正在使用 Boost Unit Test 为我的项目执行单元测试。我需要测试一些非类型模板,但似乎使用宏 BOOST_AUTO_TEST_CASE_TEMPLATE(test_case_name, formal_type_parameter_name, collection_of_types) 我只能测试类型模板。我想使用不是由{ int, float, ...} 组成的collection_of_types,而是{0,1,2, ...}。
这是我想做的一个例子:
#include <boost/test/included/unit_test.hpp>
#include <boost/mpl/list.hpp>
typedef boost::mpl::list<0, 1, 2, 4, 6> test_types;
BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
{
test_template<T>* test_tmpl = new test_template<T>();
// other code
}
【问题讨论】:
标签: c++ boost boost-test