diff --git a/src/mat.rs b/src/mat.rs index ffc2545..0b33e3e 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -300,4 +300,25 @@ mod test { // Rising from negative middle to middle assert_move_to_symmetric(-22.0, -110.0, 132.0, (22.0, 110.0)); } + + #[test] + fn mh_curve_demagnetize_across_edges() { + let curve = mh_curve_for_test(); + // Falling from saturation to start + assert_move_to_symmetric(30.0, 150.0, 120.0, (0.0, 120.0)); + // Falling from post-saturation to post-saturation + assert_move_to_symmetric(250.0, 150.0, 200.0, (50.0, 150.0)); + // Falling from post-saturation to saturation + assert_move_to_symmetric(250.0, 150.0, 180.0, (30.0, 150.0)); + // Falling from post-saturation to start + assert_move_to_symmetric(250.0, 150.0, 120.0, (0.0, 120.0)); + // Falling from post-saturation to negative saturation + assert_move_to_symmetric(250.0, 150.0, -180.0, (-30.0, -150.0)); + // Falling from post-saturation to negative post-saturation + assert_move_to_symmetric(250.0, 150.0, -400.0, (-250.0, -150.0)); + // Falling from interior to middle + assert_move_to_symmetric(28.0, 130.0, 140.0, (10.0, 130.0)); + // Falling from interior to middle + assert_move_to_symmetric(28.0, 130.0, 130.0, (5.0, 125.0)); + } }