#12241 closed Bugs (fixed)
Data-driven testing over a range of std::tuple has broken
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.62.0 | Component: | test |
Version: | Boost 1.61.0 | Severity: | Regression |
Keywords: | test, tuple, data-driven, BOOST_DATA_TEST_CASE, std::tuple | Cc: |
Description
The following code, which compiled and ran under Boost 1.60.0, fails to compile under Boost 1.61.0.
#define BOOST_TEST_MODULE boost_test_tuple_prob #include <boost/test/included/unit_test.hpp> #include <boost/test/data/test_case.hpp> #include <boost/test/data/monomorphic.hpp> #include <tuple> #include <vector> const std::vector< std::tuple<int, int>> values = { std::tuple<int, int>{ 1, 11 }, std::tuple<int, int>{ 2, 12 }, std::tuple<int, int>{ 3, 13 }, }; BOOST_DATA_TEST_CASE( test1, boost::unit_test::data::make( values ), var1, var2 ) { std::cout << var1 << ", " << var2 << "\n"; }
The compilation error is around line 66 of boost/test/data/for_each_sample.hpp
and it's complaining about tuple_size< const tuple<int, int> &>
being an incomplete type. I think the problem is just that tuple_size
doesn't work on a const reference type and this can be fixed by changing the T
in that line to typename std::decay<T>::type
.
If this sort of use of std::tuple
isn't supported (see ticket:12240) then I think Boost Test should be fixed to allow the above code but without var2
.
Change History (6)
comment:1 by , 6 years ago
Milestone: | To Be Determined → Boost 1.62.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 6 years ago
comment:4 by , 6 years ago
Good, this has been merged to master (rev 6abd34d) last week, should be in 1.62.
Please give a try to the branch origin/topic/12241-datasets-on-tuples, thanks!