fail! -> panic!
This commit is contained in:
parent
498fb60281
commit
4fcfde13de
6 changed files with 13 additions and 13 deletions
|
@ -49,7 +49,7 @@ macro_rules! assert_approx_eq_eps(
|
||||||
let eps = &($eps);
|
let eps = &($eps);
|
||||||
let (given_val, expected_val) = (&($given), &($expected));
|
let (given_val, expected_val) = (&($given), &($expected));
|
||||||
if !given_val.approx_eq_eps(expected_val, eps) {
|
if !given_val.approx_eq_eps(expected_val, eps) {
|
||||||
fail!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
|
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
|
||||||
*given_val, *expected_val, *eps
|
*given_val, *expected_val, *eps
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ macro_rules! assert_approx_eq(
|
||||||
($given: expr, $expected: expr) => ({
|
($given: expr, $expected: expr) => ({
|
||||||
let (given_val, expected_val) = (&($given), &($expected));
|
let (given_val, expected_val) = (&($given), &($expected));
|
||||||
if !given_val.approx_eq(expected_val) {
|
if !given_val.approx_eq(expected_val) {
|
||||||
fail!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
|
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
|
||||||
*given_val, *expected_val,
|
*given_val, *expected_val,
|
||||||
ApproxEq::approx_epsilon(Some(*given_val))
|
ApproxEq::approx_epsilon(Some(*given_val))
|
||||||
)
|
)
|
||||||
|
|
|
@ -422,7 +422,7 @@ impl<S> FixedArray<[[S, ..2], ..2]> for Matrix2<S> {
|
||||||
// y: FixedArray::from_fixed(y),
|
// y: FixedArray::from_fixed(y),
|
||||||
// },
|
// },
|
||||||
// }
|
// }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -502,7 +502,7 @@ impl<S> FixedArray<[[S, ..3], ..3]> for Matrix3<S> {
|
||||||
// z: FixedArray::from_fixed(z),
|
// z: FixedArray::from_fixed(z),
|
||||||
// },
|
// },
|
||||||
// }
|
// }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -587,7 +587,7 @@ impl<S> FixedArray<[[S, ..4], ..4]> for Matrix4<S> {
|
||||||
// w: FixedArray::from_fixed(w),
|
// w: FixedArray::from_fixed(w),
|
||||||
// },
|
// },
|
||||||
// }
|
// }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1095,7 +1095,7 @@ impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> {
|
||||||
3 => Matrix3::from_cols(t.x.truncate_n(j),
|
3 => Matrix3::from_cols(t.x.truncate_n(j),
|
||||||
t.y.truncate_n(j),
|
t.y.truncate_n(j),
|
||||||
t.z.truncate_n(j)),
|
t.z.truncate_n(j)),
|
||||||
_ => fail!("out of range")
|
_ => panic!("out of range")
|
||||||
};
|
};
|
||||||
let sign = if (i+j) & 1 == 1 {-one} else {one};
|
let sign = if (i+j) & 1 == 1 {-one} else {one};
|
||||||
mat.determinant() * sign * inv_det
|
mat.determinant() * sign * inv_det
|
||||||
|
|
|
@ -111,13 +111,13 @@ impl<S: BaseFloat> Intersect<Option<Point3<S>>> for (Plane<S>, Ray3<S>) {
|
||||||
|
|
||||||
impl<S: BaseFloat> Intersect<Option<Ray3<S>>> for (Plane<S>, Plane<S>) {
|
impl<S: BaseFloat> Intersect<Option<Ray3<S>>> for (Plane<S>, Plane<S>) {
|
||||||
fn intersection(&self) -> Option<Ray3<S>> {
|
fn intersection(&self) -> Option<Ray3<S>> {
|
||||||
fail!("Not yet implemented");
|
panic!("Not yet implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: BaseFloat> Intersect<Option<Point3<S>>> for (Plane<S>, Plane<S>, Plane<S>) {
|
impl<S: BaseFloat> Intersect<Option<Point3<S>>> for (Plane<S>, Plane<S>, Plane<S>) {
|
||||||
fn intersection(&self) -> Option<Point3<S>> {
|
fn intersection(&self) -> Option<Point3<S>> {
|
||||||
fail!("Not yet implemented");
|
panic!("Not yet implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ impl<S> FixedArray<[S, ..2]> for Point2<S> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_fixed(_v: [S, ..2]) -> Point2<S> {
|
fn from_fixed(_v: [S, ..2]) -> Point2<S> {
|
||||||
// match v { [x, y] => Point2 { x: x, y: y } }
|
// match v { [x, y] => Point2 { x: x, y: y } }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -275,7 +275,7 @@ impl<S> FixedArray<[S, ..3]> for Point3<S> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_fixed(_v: [S, ..3]) -> Point3<S> {
|
fn from_fixed(_v: [S, ..3]) -> Point3<S> {
|
||||||
// match v { [x, y, z] => Point3 { x: x, y: y, z: z } }
|
// match v { [x, y, z] => Point3 { x: x, y: y, z: z } }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -231,7 +231,7 @@ macro_rules! vec(
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> {
|
fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> {
|
||||||
// match v { [$($field),+] => $Self { $($field: $field),+ } }
|
// match v { [$($field),+] => $Self { $($field: $field),+ } }
|
||||||
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -438,7 +438,7 @@ impl<S: BaseNum> Vector4<S> {
|
||||||
1 => Vector3::new(self.x, self.z, self.w),
|
1 => Vector3::new(self.x, self.z, self.w),
|
||||||
2 => Vector3::new(self.x, self.y, self.w),
|
2 => Vector3::new(self.x, self.y, self.w),
|
||||||
3 => Vector3::new(self.x, self.y, self.z),
|
3 => Vector3::new(self.x, self.y, self.z),
|
||||||
_ => fail!("{} is out of range", n)
|
_ => panic!("{} is out of range", n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ fn to_and_from_quaternion()
|
||||||
if !(ax.approx_eq_eps(&bx, &0.001) &&
|
if !(ax.approx_eq_eps(&bx, &0.001) &&
|
||||||
ay.approx_eq_eps(&by, &0.001) &&
|
ay.approx_eq_eps(&by, &0.001) &&
|
||||||
az.approx_eq_eps(&bz, &0.001)) {
|
az.approx_eq_eps(&bz, &0.001)) {
|
||||||
fail!("{} != {}", a, b)
|
panic!("{} != {}", a, b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue