use crate::session::{ResponseStyle, SessionDiffState, SessionStats, SpeedMode};
#[test]
fn response_style_round_trips_persisted_values() {
for response_style in ResponseStyle::ALL {
assert_eq!(
response_style.as_str().parse::<ResponseStyle>(),
Ok(response_style)
);
assert_eq!(response_style.to_string(), response_style.as_str());
}
}
#[test]
fn response_style_rejects_unknown_persisted_value() {
let result = "verbose".parse::<ResponseStyle>();
assert_eq!(result, Err("Unknown response style: verbose".to_string()));
}
#[test]
fn response_style_exposes_stable_labels_and_descriptions() {
let values = ResponseStyle::ALL
.map(|response_style| (response_style.name(), response_style.description()));
assert_eq!(
values,
[
(
"Concise",
"Compact answers with essential results, caveats, and verification."
),
(
"Balanced",
"Enough context to understand and verify without exhaustive detail."
),
(
"Detailed",
"Thorough decisions, trade-offs, effects, and verification."
),
]
);
}
#[test]
fn speed_mode_round_trips_persisted_values() {
for speed_mode in SpeedMode::ALL {
assert_eq!(speed_mode.as_str().parse::<SpeedMode>(), Ok(speed_mode));
assert_eq!(speed_mode.to_string(), speed_mode.as_str());
}
}
#[test]
fn speed_mode_rejects_unknown_persisted_value() {
let result = "turbo".parse::<SpeedMode>();
assert_eq!(result, Err("Unknown speed mode: turbo".to_string()));
}
#[test]
fn should_show_diff_hides_only_known_empty_diffs() {
let unknown = SessionStats::default();
let empty = SessionStats {
diff_state: SessionDiffState::Empty,
..SessionStats::default()
};
let present = SessionStats {
diff_state: SessionDiffState::Present,
..SessionStats::default()
};
assert!(unknown.should_show_diff());
assert!(!empty.should_show_diff());
assert!(present.should_show_diff());
}