diff --git a/src/lib.rs b/src/lib.rs index a3a6d96..d80700a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,4 @@ pub mod v1; + +#[cfg(test)] +mod tests; diff --git a/src/tests.rs b/src/tests.rs new file mode 100644 index 0000000..bcaa243 --- /dev/null +++ b/src/tests.rs @@ -0,0 +1,23 @@ +use crate::v1::TimedBlockId; + +#[test] +fn _1()->Result<(),crate::v1::Error>{ + let file=std::fs::File::open("files/bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d").unwrap(); + let input=std::io::BufReader::new(file); + let mut bot_file=crate::v1::File::new(input).unwrap(); + println!("header={:?}",bot_file.header); + for TimedBlockId{time,block_id} in bot_file.header.offline_blocks_timeline.clone(){ + println!("offline time={} block_id={:?}",time,block_id); + let block=bot_file.read_block(block_id)?; + // offline blocks include the following event types: + // World, Gravity, Run, Camera, Setting + } + for TimedBlockId{time,block_id} in bot_file.header.realtime_blocks_timeline.clone(){ + println!("realtime time={} block_id={:?}",time,block_id); + let block=bot_file.read_block(block_id)?; + // realtime blocks include the following event types: + // Input, Output, Sound + } + + Ok(()) +}