2025-10-30 11:17:20 -07:00
|
|
|
mod clock;
|
2025-10-24 13:53:37 -07:00
|
|
|
mod rply;
|
2025-10-27 14:38:10 -07:00
|
|
|
mod statestream;
|
2025-10-30 11:17:20 -07:00
|
|
|
pub use clock::{Counter, Timer, Times, counts, stats};
|
2025-10-24 16:02:56 -07:00
|
|
|
pub use rply::*;
|
2025-10-24 13:53:37 -07:00
|
|
|
|
2025-10-28 09:40:49 -07:00
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
|
|
|
pub struct InvalidDeterminant(pub u8);
|
|
|
|
|
impl std::fmt::Display for InvalidDeterminant {
|
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
|
write!(f, "{}", self.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 13:53:37 -07:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn v2_header() {
|
2025-10-27 09:13:07 -07:00
|
|
|
let mut file =
|
|
|
|
|
std::io::BufReader::new(std::fs::File::open("examples/bobl.replay").unwrap());
|
|
|
|
|
let header = match rply::decode(&mut file).unwrap().header {
|
2025-10-24 13:53:37 -07:00
|
|
|
rply::Header::V0V1(_) => panic!("Version too low"),
|
|
|
|
|
rply::Header::V2(h) => h,
|
|
|
|
|
};
|
|
|
|
|
assert_eq!(header.base.version, 2);
|
2025-10-27 09:13:07 -07:00
|
|
|
assert_eq!(header.base.content_crc, 2_199_475_946);
|
2025-10-24 13:53:37 -07:00
|
|
|
assert_eq!(header.base.initial_state_size, 2531);
|
2025-10-27 09:13:07 -07:00
|
|
|
assert_eq!(header.base.identifier, 1_761_326_589);
|
2025-10-24 16:02:56 -07:00
|
|
|
assert_eq!(header.frame_count, 6383);
|
|
|
|
|
assert_eq!(header.block_size, 128);
|
|
|
|
|
assert_eq!(header.superblock_size, 16);
|
|
|
|
|
assert_eq!(header.checkpoint_commit_interval, 4);
|
|
|
|
|
assert_eq!(header.checkpoint_commit_threshold, 2);
|
|
|
|
|
assert_eq!(header.checkpoint_compression, rply::Compression::None);
|
2025-10-24 13:53:37 -07:00
|
|
|
}
|
|
|
|
|
}
|