use crate::models::Number;
#[cfg(not(feature = "decimal"))]
pub(crate) fn n(v: f64) -> Number {
v
}
#[cfg(feature = "decimal")]
pub(crate) fn n(v: f64) -> Number {
use rust_decimal::prelude::FromPrimitive;
rust_decimal::Decimal::from_f64(v).expect("f64 -> Decimal conversion failed in test")
}
pub(crate) fn fixture(name: &str) -> String {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("fixtures")
.join(name);
std::fs::read_to_string(path)
.unwrap_or_else(|err| panic!("failed to load fixture {name}: {err}"))
}