#pragma once #include #include #include namespace cppqc { template boost::optional arbitraryBoostOptional(RngEngine &rng, std::size_t size) { std::uniform_int_distribution<> distribution(0, 4); if (distribution(rng) == 0) { return boost::none; } else { return Arbitrary::unGen(rng, size); } } template std::vector> shrinkBoostOptional(boost::optional shrinkInput) { std::vector> result; if (shrinkInput) { result.push_back(boost::none); for (auto const &t: Arbitrary::shrink(*shrinkInput)) { result.push_back(t); } } return result; } template class ArbitraryImpl> { public: static const typename Arbitrary>::unGenType unGen; static const typename Arbitrary>::shrinkType shrink; }; template const typename Arbitrary>::unGenType ArbitraryImpl>::unGen = arbitraryBoostOptional; template const typename Arbitrary>::shrinkType ArbitraryImpl>::shrink = shrinkBoostOptional; } // namespace cppqc