Merge pull request #507 from burtonageo/update_deps_2

Update dependencies, and fix tests from fallout
This commit is contained in:
Sébastien Crozet 2018-12-29 14:33:53 +01:00 committed by GitHub
commit 564246ec1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 12 deletions

View File

@ -28,21 +28,22 @@ alloc = [ ]
[dependencies] [dependencies]
typenum = "1.10" typenum = "1.10"
generic-array = "0.11" generic-array = "0.12"
rand = { version = "0.5", default-features = false } rand = { version = "0.6", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.2", default-features = false } num-complex = { version = "0.2", default-features = false }
approx = { version = "0.3", default-features = false } approx = { version = "0.3", default-features = false }
alga = { version = "0.7", default-features = false } alga = { version = "0.7", default-features = false }
matrixmultiply = { version = "0.1", optional = true } matrixmultiply = { version = "0.2", optional = true }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true }
abomonation = { version = "0.5", optional = true } abomonation = { version = "0.7", optional = true }
mint = { version = "0.5", optional = true } mint = { version = "0.5", optional = true }
quickcheck = { version = "0.6", optional = true } quickcheck = { version = "0.7", optional = true }
[dev-dependencies] [dev-dependencies]
serde_json = "1.0" serde_json = "1.0"
rand_xorshift = "0.1"
[workspace] [workspace]
members = [ "nalgebra-lapack", "nalgebra-glm" ] members = [ "nalgebra-lapack", "nalgebra-glm" ]

View File

@ -34,6 +34,6 @@ lapack-src = { version = "0.2", default-features = false }
[dev-dependencies] [dev-dependencies]
nalgebra = { version = "0.16", path = "..", features = [ "arbitrary" ] } nalgebra = { version = "0.16", path = "..", features = [ "arbitrary" ] }
quickcheck = "0.6" quickcheck = "0.7"
approx = "0.3" approx = "0.3"
rand = "0.5" rand = "0.6"

View File

@ -48,6 +48,7 @@ where
Owned<N, D, D>: Clone + Send, Owned<N, D, D>: Clone + Send,
{ {
fn arbitrary<G: Gen>(g: &mut G) -> Self { fn arbitrary<G: Gen>(g: &mut G) -> Self {
use rand::Rng;
let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50)); let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50));
Self::new(D::from_usize(dim), || N::arbitrary(g)) Self::new(D::from_usize(dim), || N::arbitrary(g))
} }

View File

@ -49,6 +49,7 @@ where
Owned<N, D, D>: Clone + Send, Owned<N, D, D>: Clone + Send,
{ {
fn arbitrary<G: Gen>(g: &mut G) -> Self { fn arbitrary<G: Gen>(g: &mut G) -> Self {
use rand::Rng;
let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50)); let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50));
Self::new(D::from_usize(dim), || N::arbitrary(g)) Self::new(D::from_usize(dim), || N::arbitrary(g))
} }

View File

@ -693,12 +693,13 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
extern crate rand_xorshift;
use super::*; use super::*;
use rand::{self, SeedableRng}; use rand::SeedableRng;
#[test] #[test]
fn random_unit_quats_are_unit() { fn random_unit_quats_are_unit() {
let mut rng = rand::prng::XorShiftRng::from_seed([0xAB; 16]); let mut rng = rand_xorshift::XorShiftRng::from_seed([0xAB; 16]);
for _ in 0..1000 { for _ in 0..1000 {
let x = rng.gen::<UnitQuaternion<f32>>(); let x = rng.gen::<UnitQuaternion<f32>>();
assert!(relative_eq!(x.into_inner().norm(), 1.0)) assert!(relative_eq!(x.into_inner().norm(), 1.0))

View File

@ -107,9 +107,10 @@ impl<N: Real> Rotation2<N> {
/// ///
/// # Example /// # Example
/// ``` /// ```
/// # #[macro_use] extern crate approx;
/// # use nalgebra::Rotation2; /// # use nalgebra::Rotation2;
/// let rot = Rotation2::new(1.78); /// let rot = Rotation2::new(1.78);
/// assert_eq!(rot.angle(), 1.78); /// assert_relative_eq!(rot.angle(), 1.78);
/// ``` /// ```
#[inline] #[inline]
pub fn angle(&self) -> N { pub fn angle(&self) -> N {
@ -158,10 +159,11 @@ impl<N: Real> Rotation2<N> {
/// ///
/// # Example /// # Example
/// ``` /// ```
/// # #[macro_use] extern crate approx;
/// # use nalgebra::Rotation2; /// # use nalgebra::Rotation2;
/// let rot = Rotation2::new(0.78); /// let rot = Rotation2::new(0.78);
/// let pow = rot.powf(2.0); /// let pow = rot.powf(2.0);
/// assert_eq!(pow.angle(), 2.0 * 0.78); /// assert_relative_eq!(pow.angle(), 2.0 * 0.78);
/// ``` /// ```
#[inline] #[inline]
pub fn powf(&self, n: N) -> Rotation2<N> { pub fn powf(&self, n: N) -> Rotation2<N> {

View File

@ -212,10 +212,11 @@ impl<N: Real> UnitComplex<N> {
/// ///
/// # Example /// # Example
/// ``` /// ```
/// # #[macro_use] extern crate approx;
/// # use nalgebra::UnitComplex; /// # use nalgebra::UnitComplex;
/// let rot = UnitComplex::new(0.78); /// let rot = UnitComplex::new(0.78);
/// let pow = rot.powf(2.0); /// let pow = rot.powf(2.0);
/// assert_eq!(pow.angle(), 2.0 * 0.78); /// assert_relative_eq!(pow.angle(), 2.0 * 0.78);
/// ``` /// ```
#[inline] #[inline]
pub fn powf(&self, n: N) -> Self { pub fn powf(&self, n: N) -> Self {