use thiserror::Error;
#[derive(Debug, Error)]
pub enum TestError {
#[error("failed to load image '{path}': {message}")]
ImageLoad { path: String, message: String },
#[error("failed to write image '{path}': {message}")]
ImageWrite { path: String, message: String },
#[error("failed to create directory '{path}': {message}")]
DirectoryCreate { path: String, message: String },
#[error(
"value comparison failed at index {index}: expected {expected}, got {actual}, delta {delta}"
)]
ValueMismatch {
index: usize,
expected: f64,
actual: f64,
delta: f64,
},
#[error("pix comparison failed at index {index}")]
PixMismatch { index: usize },
#[error("file comparison failed at index {index}: {path}")]
FileMismatch { index: usize, path: String },
#[error("golden file not found: {path}")]
GoldenNotFound { path: String },
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}
pub type TestResult<T> = Result<T, TestError>;