use algorithms::crc::{self, Crc};
use algorithms::hash;
use criterion::{Criterion, black_box, criterion_group, criterion_main};

pub fn criterion_benchmark(c: &mut Criterion) {
    c.bench_function("crc32", |b| {
        b.iter(|| crc::Crc32::checksum(black_box(&crc::CHECK_DATA)))
    });
    c.bench_function("ffi::crc32", |b| {
        b.iter(|| crc::ffi::Crc32::checksum(black_box(&crc::CHECK_DATA)))
    });

    c.bench_function("sha2_256", |b| {
        b.iter(|| hash::sha2_256_oneshot(black_box(hash::HASH_EXAMPLE_DATA)))
    });
    c.bench_function("ffi::sha2_256", |b| {
        b.iter(|| hash::ffi::sha2_256_oneshot(black_box(hash::HASH_EXAMPLE_DATA)))
    });
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
