1#ifndef HALCHECK_GEN_ARBITRARY_HPP
2#define HALCHECK_GEN_ARBITRARY_HPP
10#include <halcheck/gen/container.hpp>
11#include <halcheck/gen/label.hpp>
12#include <halcheck/gen/optional.hpp>
13#include <halcheck/gen/sample.hpp>
14#include <halcheck/gen/shrink.hpp>
15#include <halcheck/gen/variant.hpp>
16#include <halcheck/lib/atom.hpp>
17#include <halcheck/lib/iterator.hpp>
18#include <halcheck/lib/optional.hpp>
19#include <halcheck/lib/scope.hpp>
20#include <halcheck/lib/type_traits.hpp>
21#include <halcheck/lib/variant.hpp>
30namespace halcheck {
namespace gen {
78template<typename T, HALCHECK_REQUIRE(is_arbitrary<T>())>
84inline lib::monostate arbitrary(gen::tag<lib::monostate>,
lib::atom) {
return {}; }
88template<typename T, HALCHECK_REQUIRE(std::is_integral<T>())>
93 return gen::shrink_to(
id, T(0), dst);
96template<typename T, HALCHECK_REQUIRE(std::is_floating_point<T>())>
102template<typename T, typename U, HALCHECK_REQUIRE(gen::is_arbitrary<T>()),
HALCHECK_REQUIRE(gen::is_arbitrary<U>())>
108template<
typename... Ts,
HALCHECK_REQUIRE(lib::conjunction<gen::is_arbitrary<Ts>...>())>
115template<typename T, HALCHECK_REQUIRE(gen::is_arbitrary<T>())>
120template<
typename... Ts,
HALCHECK_REQUIRE(lib::conjunction<gen::is_arbitrary<Ts>...>())>
T arbitrary(lib::atom id)
Generates an arbitrary value of a given type.
Definition arbitrary.hpp:79
static struct halcheck::gen::@9 label
Extends the unique identifiers passed to other random generation functions.
HALCHECK_INLINE_CONSTEXPR struct halcheck::gen::@11 sample
Obtains a random value.
lib::variant< lib::symbol, lib::number > atom
An atom is either a symbol or a number.
Definition atom.hpp:194
lib::iter_value_t< lib::iterator_t< R > > range_value_t
The type of element contained in a range.
Definition range.hpp:332
typename std::decay< T >::type decay_t
An implementation of std::decay_t.
Definition type_traits.hpp:101
typename std::enable_if< Cond, T >::type enable_if_t
An implementation of std::enable_if_t.
Definition type_traits.hpp:93
#define HALCHECK_REQUIRE(...)
Expands to a template argument that is only valid if the given argument evaluates to true.
Definition type_traits.hpp:24
T container(lib::atom id, F gen)
Generates a random container value.
Definition container.hpp:127
HALCHECK_INLINE_CONSTEXPR struct halcheck::gen::@10 optional
Generates a lib::optional.
lib::variant< lib::invoke_result_t< Fs, lib::atom >... > variant(lib::atom id, Fs... gens)
Constructs a random variant.
Definition variant.hpp:51
Determines if a type supports generating arbitrary values.
Definition arbitrary.hpp:68
An implementation of std::experimental::is_detected.
Definition type_traits.hpp:247