From 8ba1459602ea73c35f5d2ca8e55c5dec46a71169 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 12 Aug 2023 22:48:16 +0700 Subject: [PATCH] Use `assert_relative_eq!` instead of relative_eq!`. When testing for something, need to use the assert form. --- src/geometry/dual_quaternion.rs | 4 ++-- src/geometry/quaternion.rs | 2 +- src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/geometry/dual_quaternion.rs b/src/geometry/dual_quaternion.rs index 2272b622..02fdcc76 100644 --- a/src/geometry/dual_quaternion.rs +++ b/src/geometry/dual_quaternion.rs @@ -97,7 +97,7 @@ where /// /// let dq_normalized = dq.normalize(); /// - /// relative_eq!(dq_normalized.real.norm(), 1.0); + /// assert_relative_eq!(dq_normalized.real.norm(), 1.0); /// ``` #[inline] #[must_use = "Did you mean to use normalize_mut()?"] @@ -122,7 +122,7 @@ where /// /// dq.normalize_mut(); /// - /// relative_eq!(dq.real.norm(), 1.0); + /// assert_relative_eq!(dq.real.norm(), 1.0); /// ``` #[inline] pub fn normalize_mut(&mut self) -> T { diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 7dcbce51..9a4546bb 100644 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -138,7 +138,7 @@ where /// # use nalgebra::Quaternion; /// let q = Quaternion::new(1.0, 2.0, 3.0, 4.0); /// let q_normalized = q.normalize(); - /// relative_eq!(q_normalized.norm(), 1.0); + /// assert_relative_eq!(q_normalized.norm(), 1.0); /// ``` #[inline] #[must_use = "Did you mean to use normalize_mut()?"] diff --git a/src/lib.rs b/src/lib.rs index 93f05ff5..c021deac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,8 +36,8 @@ fn main() { let angle = 1.57; let b = Rotation3::from_axis_angle(&axis, angle); - relative_eq!(b.axis().unwrap(), axis); - relative_eq!(b.angle(), angle); + assert_relative_eq!(b.axis().unwrap(), axis); + assert_relative_eq!(b.angle(), angle); } ```