sterling/benches/bench.rs
Zachary Dziura 90a3f41c2d Release v1.0.0
This is a monumental release in the development of sterling, culminating
in the finalization of the command-line API and a stabilization of
sterling's features. Woo-hoo!!

Sterling's functionality is very basic: conversion of PHB currencies
into user-defined ones, basic arithmetic operations, and converting
custom currency amounts to the equivalent amount in PHB copper. It's
unlikely that I will be adding any additional features ontop of this
set, as it already provides functionality appropriate enough for most
usecases.

Congrats to me on finally finishing a side-project!
2018-08-06 18:21:48 -04:00

27 lines
790 B
Rust

#[macro_use]
extern crate criterion;
#[macro_use]
extern crate lazy_static;
extern crate sterling_ops;
use criterion::Criterion;
use sterling_ops::currency::Currency;
use sterling_ops::*;
lazy_static! {
static ref CURRENCIES: Vec<Currency> = vec![
Currency::new("penny", 1, "p", Some("pence".to_owned()), None),
Currency::new("shilling", 100, "s", Some("sterling".to_owned()), None),
Currency::new("guilder", 10_000, "g", None, None),
Currency::new("note", 1_000_000, "N", None, Some(true)),
];
}
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("default operation", |b| {
b.iter(|| default_operation("3p 5s 7s 132c", &CURRENCIES, true))
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);