Skip to content

Commit

Permalink
remove REQUIRE, updated test, fixed isnan
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeBouton committed Feb 26, 2020
1 parent 5fced6f commit 399ca35
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 29 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Expand Up @@ -2,18 +2,17 @@
language: julia
os:
- linux
# - osx
- osx
- windows
julia:
- 1.0
- 1.1
- 1.3
- nightly
matrix:
allow_failures:
- julia: nightly
notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --project --check-bounds=yes -e 'import Pkg; Pkg.build(); Pkg.test("Vec"; coverage=true)'

after_success:
- julia --project -e 'using Pkg; cd(Pkg.dir("Vec")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
3 changes: 3 additions & 0 deletions Project.toml
Expand Up @@ -9,6 +9,9 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
julia = "1"

[extras]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
3 changes: 0 additions & 3 deletions REQUIRE

This file was deleted.

5 changes: 3 additions & 2 deletions src/common.jl
@@ -1,7 +1,8 @@
const DUMMY_PRECISION = 1e-12

Base.isfinite(a::AbstractVec) = all(isfinite.(a))
Base.isinf(a::AbstractVec) = any(isinf.(a))
Base.isfinite(a::AbstractVec) = all(isfinite, a)
Base.isinf(a::AbstractVec) = any(isinf, a)
Base.isnan(a::AbstractVec) = any(isnan, a)

function StaticArrays.similar_type(::Type{V}, ::Type{F}, size::Size{N}) where {V<:AbstractVec, F<:AbstractFloat, N}
if size == Size(V) && eltype(V) == F
Expand Down
1 change: 0 additions & 1 deletion test/REQUIRE

This file was deleted.

31 changes: 24 additions & 7 deletions test/runtests.jl
Expand Up @@ -8,13 +8,30 @@ import Random: seed!
@test invlerp(0.0,1.0,0.7) 0.7
@test invlerp(10.0,20.0,12.0) 0.2

@testset "VecE2" begin
include("test_vecE2.jl")
end

include("test_vecE2.jl")
include("test_vecE3.jl")
include("test_vecSE2.jl")
include("test_quat.jl")
@testset "VecE3" begin
include("test_vecE3.jl")
end

include("test_coordinate_transforms.jl")
include("test_geomE2.jl")
@testset "VecSE2" begin
include("test_vecSE2.jl")
end

include("test_diff.jl")
@testset "quaternions" begin
include("test_quat.jl")
end

@testset "coordinate transforms" begin
include("test_coordinate_transforms.jl")
end

@testset "geom" begin
include("test_geomE2.jl")
end

@testset "diff" begin
include("test_diff.jl")
end
2 changes: 1 addition & 1 deletion test/test_diff.jl
Expand Up @@ -26,4 +26,4 @@ let
# @test ForwardDiff.jacobian(g, VecSE2(1.0, 2.0, 3.0)) == diagm([5.0, 5.0, 1.0])
# @test ForwardDiff.gradient(h, VecSE2(1.0, 2.0, 3.0)) == [2.0, 4.0, 0.0]
# @test ForwardDiff.hessian(h, VecSE2(1.0, 2.0, 3.0)) == [2.0 0.0 0.0; 0.0 2.0 0.0; 0.0 0.0 0.0]
end
end
10 changes: 5 additions & 5 deletions test/test_vecE2.jl
Expand Up @@ -27,12 +27,12 @@ let
@test a != b

@test a + b == VecE2(0.5, 3.0)
@test a + 1 == VecE2(1.0, 2.0)
@test a + 0.5 == VecE2(0.5, 1.5)
@test a .+ 1 == VecE2(1.0, 2.0)
@test a .+ 0.5 == VecE2(0.5, 1.5)

@test a - b == VecE2(-0.5, -1.0)
@test a - 1 == VecE2(-1.0, 0.0)
@test a - 0.5 == VecE2(-0.5, 0.5)
@test a .- 1 == VecE2(-1.0, 0.0)
@test a .- 0.5 == VecE2(-0.5, 0.5)

@test a * 2 == VecE2(0.0, 2.0)
@test a * 0.5 == VecE2(0.0, 0.5)
Expand Down Expand Up @@ -120,4 +120,4 @@ let
@test isapprox(rot(b, -π/2), VecE2( 2.0,-0.5))
@test isapprox(rot(b, π/2), VecE2(-2.0, 0.5))
@test isapprox(rot(b, 2π), b)
end
end
10 changes: 5 additions & 5 deletions test/test_vecE3.jl
Expand Up @@ -29,12 +29,12 @@ let
@test a != b

@test a + b == VecE3(0.5, 3.0, -1.0)
@test a + 1 == VecE3(1.0, 2.0, 3.0)
@test a + 0.5 == VecE3(0.5, 1.5, 2.5)
@test a .+ 1 == VecE3(1.0, 2.0, 3.0)
@test a .+ 0.5 == VecE3(0.5, 1.5, 2.5)

@test a - b == VecE3(-0.5, -1.0, 5.0)
@test a - 1 == VecE3(-1.0, 0.0, 1.0)
@test a - 0.5 == VecE3(-0.5, 0.5, 1.5)
@test a .- 1 == VecE3(-1.0, 0.0, 1.0)
@test a .- 0.5 == VecE3(-0.5, 0.5, 1.5)

@test a * 2 == VecE3(0.0, 2.0, 4.0)
@test a * 0.5 == VecE3(0.0, 0.5, 1.0)
Expand Down Expand Up @@ -122,4 +122,4 @@ let
@test isapprox(rot_normalized(VecE3(1,2,3), VecE3(1,0,0), 1.0π), VecE3(1,-2,-3))
@test isapprox(rot_normalized(VecE3(1,2,3), VecE3(0,1,0), π/2), VecE3(3,2,-1))
@test isapprox(rot_normalized(VecE3(1,2,3), VecE3(0,0,1), π/2), VecE3(-2,1,3))
end
end

0 comments on commit 399ca35

Please sign in to comment.