use super::SEEDED_MODELS;
use crate::model_pick::grammar::context_windows;
use std::collections::BTreeMap;
const LIVE_MODELS: &str = "# header\n\nmodels:\n claude-sonnet-5:\n provider: anthropic\n \
model_id: claude-sonnet-5\n context_window: 1000000\n claude-haiku-4-5:\n \
provider: anthropic\n model_id: claude-haiku-4-5\n gpt-5.4:\n provider: codex\n \
model_id: gpt-5.4\n";
#[test]
fn reads_the_context_window_each_entry_declares_keyed_on_the_wire_id() {
assert_eq!(
context_windows(SEEDED_MODELS),
BTreeMap::from([("gpt-5.4".to_owned(), 400_000)])
);
assert_eq!(
context_windows(LIVE_MODELS),
BTreeMap::from([("claude-sonnet-5".to_owned(), 1_000_000)])
);
}
#[test]
fn an_undeclarable_window_is_absent_rather_than_guessed() {
let aliased = "models:\n sonnet:\n provider: anthropic\n \
model_id: claude-sonnet-5\n context_window: 200000\n";
assert_eq!(
context_windows(aliased),
BTreeMap::from([("claude-sonnet-5".to_owned(), 200_000)])
);
let junk = "models:\n a:\n context_window: 0\n b:\n context_window: lots\n \
c:\n provider: codex\n";
assert!(context_windows(junk).is_empty());
assert!(context_windows("roles:\n worker:\n provider: codex\n").is_empty());
assert!(context_windows("").is_empty());
assert!(context_windows("models: {}\n").is_empty());
assert!(context_windows("modelsx:\n m:\n context_window: 1\n").is_empty());
assert!(context_windows("models:\n m: { context_window: 1 }\n").is_empty());
}