Macro dudect_bencher::ctbench_main_with_seeds
[−]
[src]
macro_rules! ctbench_main_with_seeds { ($(($function:path, $seed:expr)),+) => { ... }; }
Defines a fn main()
that will run all benchmarks defined by listed functions $function
and
their associated seeds (if present). Seeds are represented as Option<[u32; 4]>
. If None
is
given, a random seed will be used. The seeds are used to seed the
BenchRng
that's passed to each function.
#[macro_use] extern crate dudect_bencher; extern crate rand; use rand::Rng; use dudect_bencher::{BenchRng, Class, CtRunner}; fn foo(runner: &mut CtRunner, rng: &mut BenchRng) { println!("first u64 is {}", rng.next_u64()); // Run something so we don't get a panic runner.run_one(Class::Left, || 0); runner.run_one(Class::Right, || 0); } fn bar(runner: &mut CtRunner, rng: &mut BenchRng) { println!("first u64 is {}", rng.next_u64()); // Run something so we don't get a panic runner.run_one(Class::Left, || 0); runner.run_one(Class::Right, || 0); } ctbench_main_with_seeds!( (foo, None), (bar, Some([0x6b6c816d, 0x395d3f8e, 0x798e4828, 0xfbb23c0f])) );