use reproducible::prelude::*;
fn main() {
let my_add = |inputs: &[f64]| vec![inputs[0] + inputs[1]];
let my_sub = |inputs: &[f64]| vec![inputs[0] - inputs[1]];
let test_cases = vec![
TestCase {
inputs: vec![1.0, 2.0],
expected: vec![3.0],
},
TestCase {
inputs: vec![10.0, 5.0],
expected: vec![15.0], },
TestCase {
inputs: vec![0.0, 0.0],
expected: vec![1e-10], },
];
let report = Report::new()
.with_test_cases(test_cases)
.with_column(Column::<f64>::accuracy("Mean Accuracy"))
.with_column(Column::<f64>::accuracy("Max Error").with_stat(ColumnStat::Max))
.with_column(Column::<f64>::perf("Latency").with_stat(ColumnStat::Median))
.with_row(Row::new("My Add Fn", my_add).with_criterion_id("math/add"))
.with_row(Row::new("My Sub Fn", my_sub).with_criterion_id("math/sub"));
println!("## Reproducible Accuracy & Performance Report\n");
println!("{}", report.render_markdown());
}