boost.test fails to zip custom datasets
I am trying to understand how to use datasets with the boost.test library. I am following the documentation here http://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/tests_org... and have created my dataset as follows:
namespace bdata = boost::unit_test::data;
struct test_set {
class iterator {
int m_a;
public:
iterator()
: m_a(0){}
void operator++() {
++m_a;
}
int operator*() const {
return m_a;
}
};
using sample = int;
enum {arity = 1};
auto begin() const {
return iterator{};
}
bdata::size_t size() const {
return 5; // let's assume only 5 numbers
}
};
namespace boost { namespace unit_test { namespace data { namespace monomorphic {
template <>
struct is_dataset
AMDG On 12/07/2017 03:47 PM, Georgios Sermaidis via Boost-users wrote:
I am trying to understand how to use datasets with the boost.test library. I am following the documentation here http://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/tests_org... and have created my dataset as follows:
namespace bdata = boost::unit_test::data;
struct test_set {<snip> };
namespace boost { namespace unit_test { namespace data { namespace monomorphic {
template <> struct is_dataset
: std::true_type{}; }}}} which is very simple and iterates numbers from 0 to 4. <snip> // error: invalid operands to binary expression ('typename data::result_of::make
::type' (aka 'test_set') and 'test_set') test_set() ^ test_set(), // ~~~~~~~~~~~^~~~~~~~~~~~~ BOOST_DATA_TEST_CASE( example_test2, test_set() ^ test_set(), my_datum1, my_datum2) { std::cout << my_datum1 << " " << my_datum2 << std::endl; } Is what I am trying to do legal? If so, what is the correct way to achieve it? Thank you for your help!
The operator is not in scope and cannot be found by ADL. Try using bdata::monomorphic::operator^; In Christ, Steven Watanabe
participants (2)
-
Georgios Sermaidis
-
Steven Watanabe