use hippmem_core::model::ContentType;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BenchDataset {
pub entries: Vec<BenchEntry>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BenchEntry {
pub content_type: ContentType,
pub content: String,
pub importance: f32,
pub category: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CategoryQuerySet {
pub queries: Vec<CategoryQuery>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CategoryQuery {
pub query: String,
pub expected_categories: Vec<String>,
pub description: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CategoryTextSet {
pub categories: Vec<CategoryTexts>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CategoryTexts {
pub category: String,
pub texts: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct KeywordQuerySet {
pub queries: Vec<KeywordQuery>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct KeywordQuery {
pub query: String,
pub expected_keyword: String,
pub min_results: usize,
}
pub fn load_fixture<T: serde::de::DeserializeOwned>(locale: &str, name: &str) -> T {
crate::fixture_loader::load_bench_fixture(locale, name)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn bench_entry_roundtrip() {
let entry = BenchEntry {
content_type: ContentType::Decision,
content: "decide to use redb".into(),
importance: 0.8,
category: "tech_decisions".into(),
};
let json = serde_json::to_string(&entry).unwrap();
assert!(
json.contains("\"content_type\":\"Decision\""),
"json was: {json}"
);
let rt: BenchEntry = serde_json::from_str(&json).unwrap();
assert_eq!(entry, rt);
}
}