ravel
Deterministic simulation testing for C++. Seed a bug, replay it exact.
Loading...
Searching...
No Matches
shrink.hpp
1#pragma once
2
3#include <cstdint>
4#include <iosfwd>
5#include <string>
6#include <vector>
7
8#include "ravel/simulation.hpp"
9
10namespace ravel {
11
12using Choices = std::vector<VirtualRng::Choice>;
13
17Result replay(const SimulationSetup& setup, const Choices& choices,
18 const SimulationOptions& options = {});
19
24void write_choices(std::ostream& out, const Choices& choices);
25
28Choices read_choices(std::istream& in);
29
34 std::uint64_t max_attempts = 20'000;
35
40 unsigned threads = 0;
41
46};
47
53 Choices choices;
54 std::string choices_path;
55 std::uint64_t attempts = 0;
56 bool budget_exhausted = false;
57};
58
77ShrinkResult shrink(const SimulationSetup& setup, std::uint64_t seed,
78 const ShrinkOptions& options = {});
79
80} // namespace ravel
How one run ended.
Definition simulation.hpp:56
How shrink() searches.
Definition shrink.hpp:31
SimulationOptions simulation
Applied to every replay.
Definition shrink.hpp:45
unsigned threads
Threads that replay candidates at the same time; 0 means one per hardware thread.
Definition shrink.hpp:40
std::uint64_t max_attempts
Replays allowed while shrinking.
Definition shrink.hpp:34
What shrink() found.
Definition shrink.hpp:49
bool budget_exhausted
Stopped by max_attempts, not by finishing.
Definition shrink.hpp:56
Result minimal
The smallest failing run found.
Definition shrink.hpp:52
std::uint64_t attempts
Replays spent shrinking.
Definition shrink.hpp:55
Choices choices
Replay these to reproduce minimal.
Definition shrink.hpp:53
Choices original_choices
Its recorded choices.
Definition shrink.hpp:51
Result original
The seed's own run.
Definition shrink.hpp:50
std::string choices_path
Where choices was saved; empty if not.
Definition shrink.hpp:54
Options for one run. Every field has a sensible default.
Definition simulation.hpp:36