halcheck 1.0
Loading...
Searching...
No Matches
sample.hpp
1#ifndef HALCHECK_GEN_SAMPLE_HPP
2#define HALCHECK_GEN_SAMPLE_HPP
3
10#include <halcheck/gen/label.hpp>
11#include <halcheck/lib/atom.hpp>
12#include <halcheck/lib/effect.hpp>
13#include <halcheck/lib/pp.hpp>
14
15#include <cstdint>
16#include <limits>
17#include <stdexcept>
18
19namespace halcheck { namespace gen {
20
30
35 std::uintmax_t fallback() const { throw std::runtime_error("sample not handled"); }
36};
37
53 auto _ = gen::label(id);
55 }
57
58}} // namespace halcheck::gen
59
60#endif
static lib::effect_result_t< T > invoke(T args)
Invokes an effect.
Definition effect.hpp:118
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
#define HALCHECK_INLINE_CONSTEXPR
A backwards-compatible substitute for inline constexpr.
Definition pp.hpp:70
std::uintmax_t fallback() const
By default, lib::effect::invoke<sample_effect> throws an exception.
Definition sample.hpp:35
An effect for generating random data.
Definition sample.hpp:25
std::uintmax_t max
The maximum value that should be returned by handlers of this effect.
Definition sample.hpp:29