#![allow(dead_code)]
use serde::Deserialize;
use std::path::PathBuf;
use tinyjuice::types::ToolExecutionInput;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReduceFixture {
pub description: String,
pub input: ToolExecutionInput,
pub expected_output: String,
}
pub fn load_reduce_fixtures() -> Vec<(PathBuf, ReduceFixture)> {
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures");
let mut paths: Vec<PathBuf> = std::fs::read_dir(&dir)
.unwrap_or_else(|e| panic!("cannot read {}: {e}", dir.display()))
.filter_map(|entry| entry.ok().map(|e| e.path()))
.filter(|p| {
p.file_name()
.and_then(|n| n.to_str())
.is_some_and(|n| n.ends_with(".fixture.json"))
})
.collect();
paths.sort();
assert!(
!paths.is_empty(),
"no fixtures found in {} — the suite would silently test nothing",
dir.display()
);
paths
.into_iter()
.map(|p| {
let raw = std::fs::read_to_string(&p)
.unwrap_or_else(|e| panic!("cannot read {}: {e}", p.display()));
let fixture: ReduceFixture = serde_json::from_str(&raw)
.unwrap_or_else(|e| panic!("invalid fixture {}: {e}", p.display()));
(p, fixture)
})
.collect()
}
#[allow(dead_code)] pub fn install_test_config() {
tinyjuice::configure(tinyjuice::types::CompressOptions::default());
}