This commit is contained in:
Quaternions 2024-12-30 21:09:05 -08:00
parent 0c251f90fd
commit 083a735d85
2 changed files with 26 additions and 0 deletions

View File

@ -1 +1,4 @@
pub mod v1;
#[cfg(test)]
mod tests;

23
src/tests.rs Normal file
View File

@ -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(())
}