|
8 | 8 | // option. This file may not be copied, modified, or distributed
|
9 | 9 | // except according to those terms.
|
10 | 10 |
|
11 |
| -// Support code for rustc's built in test runner generator. Currently, |
12 |
| -// none of this is meant for users. It is intended to support the |
13 |
| -// simplest interface possible for representing and running tests |
14 |
| -// while providing a base that other test frameworks may build off of. |
| 11 | +//! Support code for rustc's built in unit-test and micro-benchmarking |
| 12 | +//! framework. |
| 13 | +//! |
| 14 | +//! Almost all user code will only be interested in `BenchHarness` and |
| 15 | +//! `black_box`. All other interactions (such as writing tests and |
| 16 | +//! benchmarks themselves) should be done via the `#[test]` and |
| 17 | +//! `#[bench]` attributes. |
| 18 | +//! |
| 19 | +//! See the [Testing Guide](../guide-testing.html) for more details. |
| 20 | +
|
| 21 | +// Currently, not much of this is meant for users. It is intended to |
| 22 | +// support the simplest interface possible for representing and |
| 23 | +// running tests while providing a base that other test frameworks may |
| 24 | +// build off of. |
15 | 25 |
|
16 | 26 | #[crate_id = "test#0.10-pre"];
|
17 | 27 | #[comment = "Rust internal test library only used by rustc"];
|
@@ -127,7 +137,11 @@ impl TestFn {
|
127 | 137 | }
|
128 | 138 | }
|
129 | 139 |
|
130 |
| -// Structure passed to BenchFns |
| 140 | +/// Manager of the benchmarking runs. |
| 141 | +/// |
| 142 | +/// This is feed into functions marked with `#[bench]` to allow for |
| 143 | +/// set-up & tear-down before running a piece of code repeatedly via a |
| 144 | +/// call to `iter`. |
131 | 145 | pub struct BenchHarness {
|
132 | 146 | priv iterations: u64,
|
133 | 147 | priv ns_start: u64,
|
@@ -1575,4 +1589,3 @@ mod tests {
|
1575 | 1589 | assert_eq!(*(m4.find(&~"throughput").unwrap()), Metric::new(50.0, 2.0));
|
1576 | 1590 | }
|
1577 | 1591 | }
|
1578 |
| - |
|
0 commit comments