rapidcheck
rapidcheck copied to clipboard
Polymorphic containers and std::function support
Hello,
Thanks for rapidcheck, its great both in API and performance. I was wondering what is the recommended way of testing polymorphic containers, something like:
// Here some type level assumption that T has the empty() method would be great, maybe:
template<typename T, typename = std::enable_if_t<is_monoid_v<T>>>
rc::check("Poly list", [](const std::list<T>& l) {
l.push_front(T());
return l.front().empty();
}
Or maybe RC_ASSERT can be used. Or perhaps some inheritance trick, making monoid a class and saying that pick an arbitrary T such that T subclasses a Monoid class. If there exists a way exists to check polymorphic types, that would be great!
Also this is a long shot, but is there any way I can get arbitrary std::function
objects?