From abd107d04a8fcb639b5bc6e130abbc42881907b2 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Tue, 16 Jul 2024 08:50:26 -0500 Subject: [PATCH] Update tests: Force return needs an Option<> The force functions are discontinuous at (0,0), and as such need to return an optional. Without this, I'll be feeding NaNs back into the program, which will propogate and cause a total simulation collapse. --- src/birdoids_plugin.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/birdoids_plugin.rs b/src/birdoids_plugin.rs index d12b9a42..921bf872 100644 --- a/src/birdoids_plugin.rs +++ b/src/birdoids_plugin.rs @@ -338,7 +338,9 @@ mod tests{ #[test] fn check_cohesion_zero_zero() { - todo!("Make test for cohesion_force when boid and target are at the same point") + let force = cohesive_force(Vec2::ZERO, Vec2::ZERO); + eprintln!("Cohesive force of overlapping points: {}", *force); + panic!() } // ********************* @@ -448,7 +450,12 @@ mod tests{ // Separation 0,0 test #[test] fn check_separation_zero_zero() { - todo!("Check what happens when a boid is on top of the point it's trying to move away from"); + let force = separation_force( + Vec2::ZERO, + Vec2::ZERO + ); + eprintln!("Separation force of overlapping points: {}", *force); + panic!() } // *********************