Skip to content

Fix discrepencies in the testing chapter #21865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/doc/trpl/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,7 @@ extern crate test;
# struct X;
# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
b.iter(|| {
let mut n = 1000_u32;

test::black_box(&mut n); // pretend to modify `n`
let n = test::black_box(1000);

range(0, n).fold(0, |a, b| a ^ b)
})
Expand All @@ -569,7 +567,7 @@ Performing either of the above changes gives the following benchmarking results

```text
running 1 test
test bench_xor_1000_ints ... bench: 1 ns/iter (+/- 0)
test bench_xor_1000_ints ... bench: 131 ns/iter (+/- 3)

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
```
Expand Down