You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+44-10
Original file line number
Diff line number
Diff line change
@@ -11,20 +11,54 @@ fuzz and property testing front-end for Rust
11
11
12
12
A copy of the Bolero Book can be found here: http://camshaft.github.io/bolero
13
13
14
-
## Installation
14
+
## Quick Start
15
15
16
-
`bolero` is on `crates.io`and can be added to a project like so:
16
+
1. Install subcommand and add a dependency
17
17
18
-
```toml
19
-
[dev-dependencies]
20
-
bolero = "0.8"
21
-
```
18
+
```console
19
+
$ cargo add --dev bolero
20
+
$ cargo install -f cargo-bolero
21
+
```
22
22
23
-
`bolero` also provides a CLI program to execute fuzz tests, [`cargo-bolero`](https://crates.io/crates/cargo-bolero). It can be installed globally with cargo:
23
+
2. Write a test using [`bolero::check!`](https://docs.rs/bolero/latest/bolero/macro.check.html) macro:
24
24
25
-
```bash
26
-
$ cargo install -f cargo-bolero
27
-
```
25
+
```rust
26
+
pub fn buggy_add(x: u32, y: u32) -> u32 {
27
+
if x == 12976 && y == 14867 {
28
+
return x.wrapping_sub(y);
29
+
}
30
+
return x.wrapping_add(y);
31
+
}
32
+
33
+
#[test]
34
+
fn fuzz_add() {
35
+
bolero::check!()
36
+
.with_type()
37
+
.cloned()
38
+
.for_each(|(a, b)| buggy_add(a, b) == a.wrapping_add(b));
39
+
}
40
+
```
41
+
42
+
3. Run the test with `cargo bolero`
43
+
44
+
```console
45
+
$ cargo bolero test fuzz_add
46
+
47
+
# ... some moments later ...
48
+
49
+
======================== Test Failure ========================
0 commit comments