From 62200f0ac5efd6d4d042f5d778d0cf2856c38c50 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Thu, 25 May 2017 12:36:16 +0200 Subject: [PATCH] drop 0.3, 0.4 fix deprecation test, 0.6 and nightly (#21) --- .travis.yml | 13 ++++++++----- REQUIRE | 3 +-- src/Quaternions.jl | 2 +- test/test_Quaternion.jl | 32 +++++++++++++++----------------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23f1a4ee..1b76d91b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,16 @@ os: - linux - osx julia: - - 0.3 - - 0.4 + - 0.5 + - 0.6 - nightly + +matrix: + allow_failures: + - julia: nightly + notifications: email: false -script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia -e 'Pkg.clone(pwd()); Pkg.build("Quaternions"); Pkg.test("Quaternions"; coverage=true)' + after_success: - julia -e 'cd(Pkg.dir("Quaternions")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' diff --git a/REQUIRE b/REQUIRE index a33a011e..1d152a30 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,3 @@ -julia 0.3 - +julia 0.5 DualNumbers Compat 0.7.15 diff --git a/src/Quaternions.jl b/src/Quaternions.jl index d6b9ef3d..2eb6a1ab 100644 --- a/src/Quaternions.jl +++ b/src/Quaternions.jl @@ -1,4 +1,4 @@ -VERSION >= v"0.4.0-dev+6521" && __precompile__() +__precompile__() module Quaternions importall Base diff --git a/test/test_Quaternion.jl b/test/test_Quaternion.jl index ebefc5f3..bd053d25 100644 --- a/test/test_Quaternion.jl +++ b/test/test_Quaternion.jl @@ -25,44 +25,42 @@ end let # test rotations qx = qrotation([1,0,0], pi/4) - @test_approx_eq qx*qx qrotation([1,0,0], pi/2) - @test_approx_eq qx^2 qrotation([1,0,0], pi/2) + @test qx*qx ≈ qrotation([1,0,0], pi/2) + @test qx^2 ≈ qrotation([1,0,0], pi/2) theta = pi/8 qx = qrotation([1,0,0], theta) c = cos(theta); s = sin(theta) Rx = [1 0 0; 0 c -s; 0 s c] - @test_approx_eq rotationmatrix(qx) Rx + @test rotationmatrix(qx) ≈ Rx theta = pi/6 qy = qrotation([0,1,0], theta) c = cos(theta); s = sin(theta) Ry = [c 0 s; 0 1 0; -s 0 c] - @test_approx_eq rotationmatrix(qy) Ry + @test rotationmatrix(qy) ≈ Ry theta = 4pi/3 qz = qrotation([0,0,1], theta) c = cos(theta); s = sin(theta) Rz = [c -s 0; s c 0; 0 0 1] - @test_approx_eq rotationmatrix(qz) Rz + @test rotationmatrix(qz) ≈ Rz - @test_approx_eq rotationmatrix(qx*qy*qz) Rx*Ry*Rz - @test_approx_eq rotationmatrix(qy*qx*qz) Ry*Rx*Rz - @test_approx_eq rotationmatrix(qz*qx*qy) Rz*Rx*Ry + @test rotationmatrix(qx*qy*qz) ≈ Rx*Ry*Rz + @test rotationmatrix(qy*qx*qz) ≈ Ry*Rx*Rz + @test rotationmatrix(qz*qx*qy) ≈ Rz*Rx*Ry a, b = qrotation([0,0,1], deg2rad(0)), qrotation([0,0,1], deg2rad(180)) - @test_approx_eq slerp(a,b,0.0) a - @test_approx_eq slerp(a,b,1.0) b - @test_approx_eq slerp(a,b,0.5) qrotation([0,0,1], deg2rad(90)) - - @test_approx_eq angle(qrotation([1,0,0], 0)) 0 - @test_approx_eq angle(qrotation([0,1,0], pi/4)) pi/4 - @test_approx_eq angle(qrotation([0,0,1], pi/2)) pi/2 - + @test slerp(a,b,0.0) ≈ a + @test slerp(a,b,1.0) ≈ b + @test slerp(a,b,0.5) ≈ qrotation([0,0,1], deg2rad(90)) + @test angle(qrotation([1,0,0], 0)) ≈ 0 + @test angle(qrotation([0,1,0], pi/4)) ≈ pi/4 + @test angle(qrotation([0,0,1], pi/2)) ≈ pi/2 let # test numerical stability of angle ax = randn(3) for θ in [1e-9, π - 1e-9] q = qrotation(ax, θ) - @test_approx_eq angle(q) θ + @test angle(q) ≈ θ end end end