[][src]Attribute Macro test_generator::bench_resources

#[bench_resources]

Macro generating bench-functions, invoking the fn for each item matching the resource-pattern.

The resource-pattern must not expand to empty list, otherwise an error is raised. The generated test-functions is a regular bench, being compiled by the rust-compiler; and being executed in sequentially by the bench-framework.

This example is not tested
#![feature(test)] // nightly feature required for API test::Bencher
#[cfg(test)]
mod tests {
  extern crate test_generator;

  #[bench_resources("res/*/input.txt")]
  fn measure_resource(b: &mut test::Bencher, resource: &str) {
     let path = std::path::Path::new(resource);
     b.iter(|| path.exists());
  }
}