use super::address::{Address, mint};
use std::path::Path;
const RECORD: &str = "steps/root-child/007/tools/toolu_01abc/output.json";
#[test]
fn a_minted_address_parses_back_to_what_was_minted() {
let minted = mint(Path::new(RECORD), "stdout", 2048);
assert_eq!(minted, format!("{RECORD}#stdout@2048"));
let parsed = Address::parse(&minted).expect("the mint is the grammar");
assert_eq!(parsed.record(), RECORD);
assert_eq!(parsed.agent_id, "root-child");
assert_eq!(parsed.stream, "stdout");
assert_eq!(parsed.offset, 2048);
}
#[test]
fn the_next_page_is_the_same_address_moved() {
let parsed = Address::parse(&format!("{RECORD}#stderr@0")).expect("grammar");
assert_eq!(parsed.at(4096), format!("{RECORD}#stderr@4096"));
}