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.
This commit is contained in:
@@ -338,7 +338,9 @@ mod tests{
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_cohesion_zero_zero() {
|
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
|
// Separation 0,0 test
|
||||||
#[test]
|
#[test]
|
||||||
fn check_separation_zero_zero() {
|
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!()
|
||||||
}
|
}
|
||||||
|
|
||||||
// *********************
|
// *********************
|
||||||
|
|||||||
Reference in New Issue
Block a user