Enable benchmarking only with a feature. >:-(
This commit is contained in:
parent
279960886e
commit
38cfbc386f
|
@ -12,5 +12,8 @@ documentation = "http://www.rust-ci.org/kennytm/qrcode-rust/doc/qrcode/index.htm
|
|||
[dependencies]
|
||||
num = "*"
|
||||
|
||||
[features]
|
||||
bench = []
|
||||
|
||||
[[bin]]
|
||||
name = "qrencode"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::cmp::min;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature="bench")]
|
||||
use test::Bencher;
|
||||
|
||||
use types::{QrResult, QrError, Mode, EcLevel, Version};
|
||||
|
@ -122,6 +122,7 @@ fn test_push_number() {
|
|||
0b1__0000000]); // 128
|
||||
}
|
||||
|
||||
#[cfg(feature="bench")]
|
||||
#[bench]
|
||||
fn bench_push_splitted_bytes(bencher: &mut Bencher) {
|
||||
bencher.iter(|| {
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
//! }
|
||||
//!
|
||||
|
||||
#![cfg_attr(test, feature(test))] // Unstable libraries
|
||||
#![cfg_attr(feature="bench", feature(test))] // Unstable libraries
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature="bench")]
|
||||
extern crate test;
|
||||
extern crate num;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
use std::slice::Iter;
|
||||
use types::{Mode, Version};
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature="bench")]
|
||||
use test::Bencher;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -451,6 +451,7 @@ mod optimize_tests {
|
|||
|
||||
}
|
||||
|
||||
#[cfg(feature="bench")]
|
||||
#[bench]
|
||||
fn bench_optimize(bencher: &mut Bencher) {
|
||||
use types::Version;
|
||||
|
|
Loading…
Reference in a new issue