Add tests for demagnetization across edges

This commit is contained in:
2020-08-28 12:50:36 -07:00
parent 48f362cb3c
commit 4cd9bb86bb

View File

@@ -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));
}
}