From ad862ae8c99e64063b72612a64ad70c73394b708 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 10 Oct 2023 02:47:17 -0700 Subject: [PATCH] unit test --- src/physics.rs | 2 +- src/timers.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/physics.rs b/src/physics.rs index 77ce97e..c0f02c4 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -47,7 +47,7 @@ pub enum InputInstruction { //for interpolation / networking / playback reasons, most playback heads will always want //to be 1 instruction ahead to generate the next state for interpolation. } -#[derive(Clone)] +#[derive(Clone,Debug)] pub struct Body { position: glam::Vec3,//I64 where 2^32 = 1 u velocity: glam::Vec3,//I64 where 2^32 = 1 u/s diff --git a/src/timers.rs b/src/timers.rs index 8bab1e5..d6a40ca 100644 --- a/src/timers.rs +++ b/src/timers.rs @@ -147,4 +147,15 @@ impl Timer{ state:UnpausedScaled{scale}, } } +} + +#[test] +fn test_timer_unscaled(){ + const ONE_SECOND:TIME=1_000_000_000; + let run_prepare=paused(); + + let run_start=run_prepare.unpause(ONE_SECOND); + let run_finish=run_start.pause(11*ONE_SECOND); + + assert_eq!(run_finish.time(),10*ONE_SECOND); } \ No newline at end of file