lib/hypothesis/src/root.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 //! Runs tests by searching for inputs that make a test fail. A function that
2 //! draws its inputs and fails when the claim under test fails for them is a
3 //! *property*. Every draw goes through the run's data object, which appends the
4 //! choice with its kind, its value, and the bounds it was drawn within. The
5 //! recorded list of the draws a property made is the *choice sequence*. Because
6 //! the draws are recorded in order, a later run can feed the same sequence back
7 //! into the same generator and get the same input.
8 //!
9 //! The search for a smaller choice sequence that still fails is *shrinking*. A
10 //! generator can label a range of the choice sequence, opened and closed around
11 //! a part of the generator, as a *span*, which gives shrinking a unit to delete
12 //! or simplify. Shrinking replays a candidate sequence through the property and
13 //! keeps the candidate when the property still fails, within the run's shrink
14 //! budget. The passes delete spans, replace a span with its simplest value, and
15 //! reduce individual choices.
16 //!
17 //! A property can report a finite number to say how interesting its input was
18 //! as a *target score*, and the engine then spends a further budget mutating
19 //! the best-scoring sequence to raise that score.
20 //!
21 //! A failing sequence is saved to the directory called the *failure database*
22 //! and replayed first on the next run. Limits for one run, called *settings*,
23 //! bound a run by examples, replays, choices, input bytes, shrinks, and
24 //! targeted attempts, with `quick`, `dev`, and `ci` presets scaling all of them
25 //! together.
26
27 pub const conjecture = @import("conjecture.zig");
28 pub const strategies = @import("strategy.zig");
29 pub const composites = @import("composites.zig");
30 pub const engine = @import("engine.zig");
31 pub const shrinker = @import("shrinker.zig");
32 pub const database = @import("database.zig");
33 pub const report = @import("report.zig");
34 pub const stateful = @import("stateful.zig");
35 pub const swarm = @import("swarm.zig");
36 pub const coverage = @import("coverage.zig");
37 pub const artifact = @import("artifact.zig");
38 const testing = @import("testing.zig");
39 pub const autoderive = @import("auto.zig");
40 pub const value = @import("value.zig");
41
42 pub const auto = autoderive.auto;
43
44 pub const ConjectureData = conjecture.ConjectureData;
45 pub const ChoiceNode = conjecture.ChoiceNode;
46 pub const ChoiceKind = conjecture.ChoiceKind;
47 pub const Status = conjecture.Status;
48 pub const Span = conjecture.Span;
49 pub const DrawError = conjecture.DrawError;
50 pub const TargetError = conjecture.TargetError;
51 pub const TargetObservation = conjecture.TargetObservation;
52 pub const Strategy = strategies.Strategy;
53 pub const Config = value.Config;
54 pub const Generator = value.Generator;
55
56 pub const check = testing.check;
57 pub const checkNamed = testing.checkNamed;
58 pub const forAll = testing.forAll;
59 pub const forAllNamed = testing.forAllNamed;
60 pub const fuzz = testing.fuzz;
61 pub const fuzzWithSettings = testing.fuzzWithSettings;
62 pub const checkFn = engine.run;
63 pub const Settings = engine.Settings;
64 pub const TestResult = engine.TestResult;
65 pub const FuzzInputOptions = testing.FuzzInputOptions;
66 pub const Coverage = coverage.Counters;
67 pub const CoverageCounts = coverage.Counts;
68 pub const integer = value.integer;
69 pub const float32 = value.float32;
70 pub const float64 = value.float64;
71 pub const boolean = value.boolean;
72 pub const bytes = value.bytes;
73 pub const BoundedArray = value.BoundedArray;
74 pub const list = value.list;
75 pub const fixedArray = value.fixedArray;
76 pub const tuple = value.tuple;
77 pub const oneOf = value.oneOf;
78 pub const target = conjecture.target;
79 pub const gen_point = value.gen_point;
80 pub const gen_unit_vec3 = value.gen_unit_vec3;
81 pub const gen_quaternion = value.gen_quaternion;
82 pub const checkValue = value.checkValue;
83 pub const checkValueAlloc = value.checkValueAlloc;
84
85 pub const ReplayCursor = @import("database.zig").ReplayCursor;