From f8996c958c28b9740527c72c596d0cac32ea6fbc Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Tue, 17 Mar 2026 09:35:25 -0700 Subject: [PATCH] integration test --- Cargo.lock | 9 +++++++++ Cargo.toml | 1 + integration-tests/Cargo.toml | 9 +++++++++ integration-tests/src/main.rs | 25 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 integration-tests/Cargo.toml create mode 100644 integration-tests/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 4be220e..9385e42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -858,6 +858,15 @@ dependencies = [ "hashbrown 0.16.1", ] +[[package]] +name = "integration-tests" +version = "0.1.0" +dependencies = [ + "strafesnet_common", + "strafesnet_roblox_bot_file", + "strafesnet_roblox_bot_player", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.2" diff --git a/Cargo.toml b/Cargo.toml index 399d6b7..3e6d2e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "integration-tests", "lib", "native-player", "video-encoder", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml new file mode 100644 index 0000000..6f316ea --- /dev/null +++ b/integration-tests/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "integration-tests" +version = "0.1.0" +edition = "2024" + +[dependencies] +strafesnet_common.workspace = true +strafesnet_roblox_bot_file.workspace = true +strafesnet_roblox_bot_player.workspace = true diff --git a/integration-tests/src/main.rs b/integration-tests/src/main.rs new file mode 100644 index 0000000..c79f348 --- /dev/null +++ b/integration-tests/src/main.rs @@ -0,0 +1,25 @@ +use strafesnet_roblox_bot_file::v0; +use strafesnet_roblox_bot_player::{bot,bvh,head}; +use head::Time as PlaybackTime; +use strafesnet_common::session::Time as SessionTime; + +fn main(){ + let bot=include_bytes!("../../web-demo/bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d.qbot"); + let timelines=v0::read_all_to_block(std::io::Cursor::new(bot)).unwrap(); + let bot=bot::CompleteBot::new(timelines); + let bvh=bvh::Bvh::new(&bot); + + // sample the position at 0.24s + let mut playback0=head::PlaybackHead::new(&bot,SessionTime::ZERO); + for i in 0..10{ + let sample_time=PlaybackTime::from_millis(6543+1*i); + playback0.set_time(&bot,SessionTime::ZERO,sample_time); + let pos=playback0.get_position(&bot,SessionTime::ZERO); + + // get the closest time on the timeline (convert to PlaybackTime which starts at 0) + let closest_time=bot.playback_time(bvh.closest_time_to_point(&bot,pos).unwrap()); + println!("time={sample_time} closest_time={closest_time}"); + } + // let mut playback1=head::PlaybackHead::new(&bot,SessionTime::ZERO); + // playback1.set_time(&bot,SessionTime::ZERO,sample_time); +}