14struct hegel_collection_t;
16struct hegel_state_machine_t;
22namespace hegel::internal {
35 enum class SpanLabel : uint64_t {
56 void start_span(
const TestCase& tc, SpanLabel label);
57 void stop_span(
const TestCase& tc,
bool discard =
false);
59 int64_t draw_integer(
const TestCase& tc, int64_t min_value,
62 uint64_t draw_integer_unsigned(
const TestCase& tc, uint64_t min_value,
64 bool draw_boolean(
const TestCase& tc,
double p,
65 std::optional<bool> forced = std::nullopt);
66 double draw_float(
const TestCase& tc, uint32_t width,
double min_value,
67 double max_value,
bool allow_nan,
bool allow_infinity,
68 bool exclude_min,
bool exclude_max,
69 double smallest_nonzero_magnitude);
71 inline constexpr uint64_t no_max_size = ~uint64_t{0};
72 class CollectionHandle {
74 CollectionHandle(
const TestCase& tc, uint64_t min_size,
77 CollectionHandle(
const CollectionHandle&) =
delete;
78 CollectionHandle& operator=(
const CollectionHandle&) =
delete;
80 bool more(
const TestCase& tc);
82 void reject(
const TestCase& tc,
const char* why);
85 hegel_collection_t* handle_ =
nullptr;
90 explicit PoolHandle(
const TestCase& tc);
92 PoolHandle(
const PoolHandle&) =
delete;
93 PoolHandle& operator=(
const PoolHandle&) =
delete;
96 int64_t add(
const TestCase& tc);
99 int64_t draw_variable(
const TestCase& tc,
bool consume);
102 hegel_pool_t* handle_ =
nullptr;
105 inline constexpr int64_t state_machine_done = -1;
106 class StateMachineHandle {
108 StateMachineHandle(
const TestCase& tc,
109 const std::vector<std::string>& rule_names,
110 const std::vector<std::string>& invariant_names);
111 ~StateMachineHandle();
112 StateMachineHandle(
const StateMachineHandle&) =
delete;
113 StateMachineHandle& operator=(
const StateMachineHandle&) =
delete;
117 int64_t next_rule(
const TestCase& tc);
120 void rule_rejected(
const TestCase& tc);
123 hegel_state_machine_t* handle_ =
nullptr;
126 class NoteIndentScope {
128 explicit NoteIndentScope(
const TestCase& tc);
130 NoteIndentScope(
const NoteIndentScope&) =
delete;
131 NoteIndentScope& operator=(
const NoteIndentScope&) =
delete;
139 DrawLogScope(
const TestCase& tc, std::string_view name,
142 DrawLogScope(
const DrawLogScope&) =
delete;
143 DrawLogScope& operator=(
const DrawLogScope&) =
delete;
145 bool should_log()
const;
147 void log(
const std::string& rendered)
const;
152 std::string display_;
159 class HegelReject :
public std::exception {
161 const char* what() const noexcept
override {
162 return "test case rejected";
171 class HegelStopTest :
public std::exception {
173 const char* what() const noexcept
override {
174 return "test case stopped by backend";