#![allow(clippy::unwrap_used, clippy::expect_used)]
use timeglyph::interpret;
#[test]
fn fat_on_disk_hex_decodes_to_fat() {
let groups = interpret::interpret_hex("a45a597a").unwrap();
assert!(
groups
.iter()
.any(|(label, cands)| label.to_lowercase().contains("fat")
&& cands.iter().any(|c| c.format_id == "fat"
&& c.rendered
.as_deref()
.unwrap_or("")
.starts_with("2025-05-04T15:18:50"))),
"expected a FAT on-disk candidate from a45a597a: {groups:?}"
);
}
#[test]
fn fat_hex_offers_both_word_orders() {
let groups = interpret::interpret_hex("a45a597a").unwrap();
let date_time = groups
.iter()
.any(|(l, c)| l.contains("date|time") && c.iter().any(|x| x.format_id == "fat"));
let time_date = groups
.iter()
.any(|(l, c)| l.contains("time|date") && c.iter().any(|x| x.format_id == "fat"));
assert!(date_time, "missing date|time order: {groups:?}");
assert!(time_date, "missing time|date (directory) order: {groups:?}");
}
#[test]
fn hex_notes_trailing_bytes() {
let groups = interpret::interpret_hex("a45a597affff").unwrap();
assert!(
groups.iter().any(|(label, _)| label.contains("of 6")),
"expected a 'first N of 6' note: {groups:?}"
);
}
#[test]
fn hex_all_ones_u64_is_flagged_sentinel() {
let groups = interpret::interpret_hex("ffffffffffffffff").unwrap();
assert!(
groups
.iter()
.any(|(_, cands)| cands.iter().any(|c| c.sentinel)),
"expected an all-ones sentinel candidate: {groups:?}"
);
}