mirror of
https://github.com/italicsjenga/agb.git
synced 2025-02-02 12:36:35 +11:00
test for accuracy of magnitude function
This commit is contained in:
parent
affa27c8e0
commit
3800be4dcb
1 changed files with 9 additions and 0 deletions
|
@ -703,6 +703,15 @@ impl<const N: usize> Vector2D<Num<i32, N>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn magnitude_accuracy(_gba: &mut crate::Gba) {
|
||||
let n: Vector2D<Num<i32, 16>> = (3, 4).into();
|
||||
assert!((n.magnitude() - 5).abs() < num!(0.1));
|
||||
|
||||
let n: Vector2D<Num<i32, 8>> = (3, 4).into();
|
||||
assert!((n.magnitude() - 5).abs() < num!(0.1));
|
||||
}
|
||||
|
||||
impl<T: Number, P: Number + Into<T>> From<(P, P)> for Vector2D<T> {
|
||||
fn from(f: (P, P)) -> Self {
|
||||
Vector2D::new(f.0.into(), f.1.into())
|
||||
|
|
Loading…
Add table
Reference in a new issue